Skip to content

Commit

Permalink
Rename index.esm.js -> esm.mjs (#249 take 2) (#257)
Browse files Browse the repository at this point in the history
* Rename index.esm.js -> esm.mjs
This is needed for node to properly deduce that the file is ESM.
Otherwise, node crashes when you try to `import("vectorious")` with an error like:
> Uncaught SyntaxError: Unexpected token 'export'

* 6.1.12
  • Loading branch information
rotu authored Sep 14, 2023
1 parent 274fbee commit cc20cb5
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ It exposes a global variable named `v` in the `window` object and can be accesse

#### ES module

Added in version 6.1.0, vectorious exposes an ES module bundle at `dist/index.esm.js` which can be imported using the `import` syntax:
Added in version 6.1.0, vectorious exposes an ES module bundle at `dist/index.mjs` which can be imported using the `import` syntax:

```typescript
import { array } from 'vectorious';
Expand Down
2 changes: 1 addition & 1 deletion dist/index.esm.js → dist/index.mjs

Large diffs are not rendered by default.

File renamed without changes.
2 changes: 1 addition & 1 deletion docs/vectorious/6.1.11/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ <h4>Browser</h4>
&lt;/script>
</code></pre>
<h4>ES module</h4>
<p>Added in version 6.1.0, vectorious exposes an ES module bundle at <code>dist/index.esm.js</code> which can be imported using the <code>import</code> syntax:</p>
<p>Added in version 6.1.0, vectorious exposes an ES module bundle at <code>dist/index.mjs</code> which can be imported using the <code>import</code> syntax:</p>
<pre class="prettyprint source lang-typescript"><code>import { array } from 'vectorious';

const x = array([1, 2, 3]);
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "vectorious",
"version": "6.1.11",
"version": "6.1.12",
"description": "A high performance linear algebra library.",
"main": "dist/index.js",
"browser": "dist/index.browser.js",
"module": "dist/index.esm.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.esm.js"
"import": "./dist/index.mjs"
}
},
"scripts": {
Expand All @@ -21,7 +21,7 @@
"docs": "tsc --outDir built && jsdoc --configure jsdoc.json && rimraf built",
"build:node": "esbuild --bundle src/index.ts --minify --sourcemap --platform=node --outfile=dist/index.js --external:nblas --external:nlapack",
"build:browser": "esbuild --bundle src/index.ts --minify --sourcemap --platform=browser --global-name=v --outfile=dist/index.browser.js --external:nblas --external:nlapack",
"build:esm": "esbuild --bundle src/index.ts --minify --sourcemap --format=esm --outfile=dist/index.esm.js --external:nblas --external:nlapack",
"build:esm": "esbuild --bundle src/index.ts --minify --sourcemap --format=esm --outfile=dist/index.mjs --external:nblas --external:nlapack",
"build": "rimraf dist && tsc -emitDeclarationOnly && npm run build:node && npm run build:browser && npm run build:esm",
"prepublishOnly": "npm run build"
},
Expand Down

0 comments on commit cc20cb5

Please sign in to comment.