Skip to content

Commit b2db62b

Browse files
authored
feature: support importing ES module from Node.js (#901) (#921)
1 parent 53c2f91 commit b2db62b

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

package.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,19 @@
33
"version": "9.0.0-beta.1",
44
"description": "Create your next immutable state by mutating the current one",
55
"main": "dist/index.js",
6-
"module": "dist/immer.esm.js",
6+
"module": "dist/immer.esm.mjs",
7+
"exports": {
8+
".": {
9+
"import": "./dist/immer.esm.mjs",
10+
"require": "./dist/index.js"
11+
},
12+
"./*": "./*"
13+
},
714
"umd:main": "dist/immer.umd.production.min.js",
815
"unpkg": "dist/immer.umd.production.min.js",
916
"jsdelivr": "dist/immer.umd.production.min.js",
10-
"jsnext:main": "dist/immer.esm.js",
11-
"react-native": "dist/immer.esm.js",
17+
"jsnext:main": "dist/immer.esm.mjs",
18+
"react-native": "dist/immer.esm.mjs",
1219
"source": "src/immer.ts",
1320
"types": "./dist/immer.d.ts",
1421
"typesVersions": {
@@ -32,7 +39,7 @@
3239
"watch": "jest --watch",
3340
"coverage": "jest --coverage",
3441
"coveralls": "jest --coverage && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls && rm -rf ./coverage",
35-
"build": "rimraf dist/ && tsdx build --name immer --format esm,cjs,umd && yarn build:flow",
42+
"build": "rimraf dist/ && tsdx build --name immer --format esm,cjs,umd && cp dist/immer.esm.js dist/immer.esm.mjs && yarn build:flow",
3643
"build:flow": "cpx 'src/types/index.js.flow' dist -v",
3744
"publish-docs": "cd website && GIT_USER=mweststrate USE_SSH=true yarn docusaurus deploy",
3845
"start": "cd website && yarn start",

0 commit comments

Comments
 (0)