Skip to content

Commit

Permalink
fix: Improve "require" and "commonjs" support
Browse files Browse the repository at this point in the history
Signed-off-by: Gordon Smith <[email protected]>
  • Loading branch information
GordonSmith committed Dec 8, 2023
1 parent bd41149 commit 9c3b84d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,35 @@
".": {
"types": "./types/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs",
"default": "./dist/index.umd.js"
},
"./base91": {
"types": "./types/base91.d.ts",
"import": "./dist/base91.js",
"require": "./dist/base91.cjs",
"default": "./dist/base91.umd.js"
},
"./expat": {
"types": "./types/expat.d.ts",
"import": "./dist/expat.js",
"require": "./dist/expat.cjs",
"default": "./dist/expat.umd.js"
},
"./graphviz": {
"types": "./types/graphviz.d.ts",
"import": "./dist/graphviz.js",
"require": "./dist/graphviz.cjs",
"default": "./dist/graphviz.umd.js"
},
"./zstd": {
"types": "./types/zstd.d.ts",
"import": "./dist/zstd.js",
"require": "./dist/zstd.cjs",
"default": "./dist/zstd.umd.js"
}
},
"main": "./dist/index.umd.js",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"browser": "./dist/index.umd.js",
"unpkg": "./dist/index.umd.js",
Expand Down Expand Up @@ -167,4 +172,4 @@
"url": "https://github.com/hpcc-systems/hpcc-js-wasm/issues"
},
"homepage": "https://hpcc-systems.github.io/hpcc-js-wasm/"
}
}
10 changes: 10 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ const browserTplIndex = (input, umdOutput, esOutput) => ({
format: "umd",
sourcemap: true,
name: pkg.name
}, {
file: esOutput + ".cjs",
format: "commonjs",
sourcemap: true,
name: pkg.name
}, {
file: esOutput + ".js",
format: "es",
Expand All @@ -42,6 +47,11 @@ const browserTpl = (input, umdOutput, esOutput) => ({
format: "umd",
sourcemap: true,
name: pkg.name
}, {
file: esOutput + ".cjs",
format: "commonjs",
sourcemap: true,
name: pkg.name
}, {
file: esOutput + ".js",
format: "es",
Expand Down

0 comments on commit 9c3b84d

Please sign in to comment.