Skip to content

Commit

Permalink
[js] generate mjs file for esm
Browse files Browse the repository at this point in the history
  • Loading branch information
hdoan741 committed Jan 28, 2024
1 parent d6d6b30 commit 7126261
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"license": "MIT",
"exports": {
".": {
"import": "./dist/index.js",
"import": "./dist/index.mjs",
"require": "./dist/cjs/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions javascript/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export default {
{
dir: isCJSBuild ? 'dist/cjs' : 'dist',
format: isCJSBuild ? 'cjs' : 'esm',
entryFileNames: isCJSBuild ? '[name].js' : '[name].mjs', // Output file name pattern
chunkFileNames: isCJSBuild ? '[name]-[hash].js' : '[name]-[hash].mjs', // For code splitting
},
],
plugins: [ts({ tsconfig: isCJSBuild ? 'tsconfig.cjs.json' : 'tsconfig.json' }), commonjsPkgJSONPlugin()],
Expand Down

0 comments on commit 7126261

Please sign in to comment.