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 Feb 9, 2022
1 parent 3a033f6 commit 1376d8b
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 @@ -35,7 +35,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 @@ -20,6 +20,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/esm-browser/bin"
rm -rf "$DIR/esm-browser/uuid-bin.js"
Expand Down

0 comments on commit 1376d8b

Please sign in to comment.