diff --git a/package-lock.json b/package-lock.json index a9dd3bf..a174b9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,6 @@ "rollup-plugin-cleaner": "^1.0.0", "rollup-plugin-delete": "^2.0.0", "rollup-plugin-dts": "^6.0.1", - "rollup-plugin-mjs-entry": "^0.1.1", "ts-node": "^10.9.2", "typescript": "^5.1.3" }, @@ -6839,12 +6838,6 @@ "typescript": "^4.5 || ^5.0" } }, - "node_modules/rollup-plugin-mjs-entry": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-mjs-entry/-/rollup-plugin-mjs-entry-0.1.1.tgz", - "integrity": "sha512-uii0Txyrn4YCgP++fypLqsT3LgO3Fx0gAZLZlWRSwKCuZ+bdSzAzdVbJFATmCHcBNlO61i65EgemOVdVQYONHA==", - "dev": true - }, "node_modules/run-applescript": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", diff --git a/package.json b/package.json index 42bc4c1..6284feb 100644 --- a/package.json +++ b/package.json @@ -14,13 +14,13 @@ "node": ">=18" }, "main": "./dist/index.cjs", - "module": "./dist/index.cjs.mjs", + "module": "./dist/index.mjs", "types": "./dist/index.d.ts", "exports": { ".": { "types": "./dist/index.d.ts", "require": "./dist/index.cjs", - "import": "./dist/index.cjs.mjs" + "import": "./dist/index.mjs" }, "./package.json": "./package.json" }, @@ -64,7 +64,6 @@ "rollup-plugin-cleaner": "^1.0.0", "rollup-plugin-delete": "^2.0.0", "rollup-plugin-dts": "^6.0.1", - "rollup-plugin-mjs-entry": "^0.1.1", "ts-node": "^10.9.2", "typescript": "^5.1.3" } diff --git a/rollup.config.js b/rollup.config.js index dcfbde1..a997884 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,7 +1,6 @@ import strip from '@rollup/plugin-strip' import ts from '@rollup/plugin-typescript' import cleaner from 'rollup-plugin-cleaner' -import mjsEntry from 'rollup-plugin-mjs-entry' import dts from 'rollup-plugin-dts' import del from "rollup-plugin-delete"; @@ -12,9 +11,18 @@ export default [ input: './src/index.ts', output: [ { - file: `${OUTPUT_DIR}/index.cjs`, + dir: OUTPUT_DIR, + entryFileNames: '[name].cjs', + chunkFileNames: '[name]-[hash].cjs', format: 'cjs', sourcemap: false + }, + { + dir: OUTPUT_DIR, + entryFileNames: '[name].mjs', + chunkFileNames: '[name]-[hash].mjs', + format: 'es', + sourcemap: false } ], plugins: [ @@ -25,8 +33,7 @@ export default [ declarationDir: `${OUTPUT_DIR}/dts`, } }), - strip(), - mjsEntry() // https://nodejs.org/api/packages.html#packages_dual_commonjs_es_module_packages + strip() ] }, {