Skip to content

Commit

Permalink
Merge pull request #150 from GrumpySailor/fix/commonjs
Browse files Browse the repository at this point in the history
Fix CommonJS module loaded as ECMAScript module
  • Loading branch information
Pomax committed Apr 20, 2021
2 parents c6a33e6 + 094da68 commit 9448953
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
10 changes: 10 additions & 0 deletions README.md
Expand Up @@ -41,6 +41,16 @@ const Bezier = require("bezier-js");
const b = new Bezier(...);
```

### Node support matrix

| Node Version | Require Supported | Import Supported |
| ------------ | ----------------- | ----------------------------------- |
| v12.0.0 | Yes | Yes <sup>Experimental Flag</sup> |
| v12.14.1 | Yes | No <sup>Experimental Flag</sup> |
| v12.17.0 | Yes | Yes <sup>Experimental Warning</sup> |
| v12.22.1 | Yes | Yes |
| v14.0.0 | Yes | Yes |
| v14.16.1 | Yes | Yes |

## In Node or the browser, from file

Expand Down
File renamed without changes.
11 changes: 7 additions & 4 deletions package.json
Expand Up @@ -4,8 +4,11 @@
"author": "Pomax",
"description": "A javascript library for working with Bezier curves",
"type": "module",
"exports": "./src/bezier.js",
"main": "./dist/bezier.common.js",
"exports": {
"import": "./src/bezier.js",
"require": "./dist/bezier.cjs"
},
"main": "./dist/bezier.cjs",
"license": "MIT",
"bugs": {
"url": "https://github.com/Pomax/bezierjs/issues"
Expand All @@ -18,7 +21,7 @@
"funding": {
"type": "individual",
"url": "https://github.com/Pomax/bezierjs/blob/master/FUNDING.md"
},
},
"keywords": [
"bezier",
"curves"
Expand All @@ -29,7 +32,7 @@
"-----": "------------------------------------------",
"build:docs": "npm run rollup -- ./docs/js/bezier.js",
"build:dist": "npm run rollup -- ./dist/bezier.js",
"build:cjs": "babel --plugins @babel/plugin-transform-modules-commonjs dist/bezier.js --out-file dist/bezier.common.js",
"build:cjs": "babel --plugins @babel/plugin-transform-modules-commonjs dist/bezier.js --out-file dist/bezier.cjs",
"rollup": "rollup ./src/bezier.js --format esm --file ",
"lint:lib": "prettier ./src/**/*.js --write",
"lint:test": "prettier ./test/**/*.js --write",
Expand Down

0 comments on commit 9448953

Please sign in to comment.