huozhi / rollup-preserve-directives

This is a rollup plugin that helps preserve shebang and string directives.
https://npmjs.com/package/rollup-preserve-directives
34 stars 4 forks source link

chore(build): make output esm filename with `.mjs` ext #7

Closed SukkaW closed 1 year ago

SukkaW commented 1 year ago

Fixes https://github.com/SukkaW/rollup-plugin-swc/issues/39.

It seems that Rollup is mistakenly treating rollup-plugin-swc-preserve-directives/dist/es/index.js as a CJS module, even though it's specified as an ESM module in the package.json.

In this PR, I change the ./dist/es/index.js to ./dist/es/index.mjs which may help Rollup correctly recognize and treat the file as an ESM module.

After the PR, the bunchee will output ./dist/es/index.mjs instead of ./dist/es/index.js.

SukkaW commented 1 year ago

The PR is working, confirmed by https://github.com/SukkaW/rollup-plugin-swc/issues/39#issuecomment-1642902932