diff --git a/javascript/package.json b/javascript/package.json index 92f9b32..71fd5ec 100644 --- a/javascript/package.json +++ b/javascript/package.json @@ -14,7 +14,7 @@ "license": "MIT", "exports": { ".": { - "import": "./dist/index.js", + "import": "./dist/index.mjs", "require": "./dist/cjs/index.js" }, "./package.json": "./package.json" diff --git a/javascript/rollup.config.js b/javascript/rollup.config.js index c4c9bc9..464c357 100644 --- a/javascript/rollup.config.js +++ b/javascript/rollup.config.js @@ -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()],