Skip to content

Commit

Permalink
fix: importing through mjs in webpack@4
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Aug 10, 2022
1 parent f2826b6 commit 27ad96d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"uuid": "./dist/bin/uuid"
},
"sideEffects": false,
"main": "./dist/index.js",
"main": "./dist/index",
"exports": {
".": {
"node": {
Expand All @@ -39,7 +39,8 @@
"./dist/native.js": "./dist/native-browser.js",
"./dist/rng.js": "./dist/rng-browser.js",
"./dist/sha1.js": "./dist/sha1-browser.js",
"./dist/esm-node/index.js": "./dist/esm-browser/index.js"
"./dist/esm-node/index.js": "./dist/esm-browser/index.js",
"./dist/index.mjs": "./dist/esm-browser/index.js"
},
"files": [
"CHANGELOG.md",
Expand Down
2 changes: 2 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ babel --env-name esmBrowser src --source-root src --out-dir "$DIR/esm-browser" -
# Transpile ESM versions of files for node
babel --env-name esmNode src --source-root src --out-dir "$DIR/esm-node" --copy-files --quiet

echo "export * from './esm-node';" > "$DIR/index.mjs"

# No need to have the CLI files in the esm build
rm -rf "$DIR/commonjs-browser/bin"
rm -rf "$DIR/commonjs-browser/uuid-bin.js"
Expand Down

0 comments on commit 27ad96d

Please sign in to comment.