Skip to content

Commit 1f98518

Browse files
authored
fix: copy files to mjs for node compat (#58)
* fix: copy files to mjs for node compat * fix: correct pkg.json
1 parent ce46ca7 commit 1f98518

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

package.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
"exports": {
99
".": {
1010
"types": "./types/index.d.ts",
11-
"import": "./dist/esm/index.js",
12-
"browser": "./dist/cjs/index.js"
11+
"browser": "./dist/esm/index.js",
12+
"import": "./dist/esm/index.mjs",
13+
"require": "./dist/cjs/index.js"
1314
},
1415
"./pure": {
1516
"types": "./pure.d.ts",
16-
"import": "./dist/esm/pure.js",
17-
"browser": "./dist/cjs/pure.js"
17+
"browser": "./dist/esm/pure.js",
18+
"import": "./dist/esm/pure.mjs",
19+
"require": "./dist/cjs/pure.js"
1820
}
1921
},
2022
"license": "MIT",
@@ -53,9 +55,10 @@
5355
"toc": "doctoc README.md",
5456
"lint": "eslint src/**/*.js --fix",
5557
"clean": "rimraf dist",
56-
"build": "npm run build:cjs && npm run build:esm",
58+
"build": "npm run build:cjs && npm run build:esm && npm run copy:mjs",
5759
"build:cjs": "babel src --out-dir dist/cjs --config-file ./.babelrc --ignore '**/__tests__/**,**/__mocks__/**'",
5860
"build:esm": "babel src --no-babelrc --out-dir dist/esm --config-file ./.babelrc.esm.json --ignore '**/__tests__/**,**/__mocks__/**'",
61+
"copy:mjs": "cp ./dist/esm/fire-event.js ./dist/esm/fire-event.mjs && cp ./dist/esm/pure.js ./dist/esm/pure.mjs && cp ./dist/esm/index.js ./dist/esm/index.mjs",
5962
"test": "jest src/__tests__ ",
6063
"test:watch": "npm test --watch",
6164
"test:update": "npm test --updateSnapshot --coverage",

0 commit comments

Comments
 (0)