developit / microbundle

📦 Zero-configuration bundler for tiny modules.
https://npm.im/microbundle
MIT License
8.06k stars 361 forks source link

fix default extension to cjs for package.json "type":"module" #802

Closed aheissenberger closed 3 years ago

aheissenberger commented 3 years ago

The old implementation will not allow to use a filename with the extension ".cjs" in the "main" field and does not create a Common JS file with a ".cjs" ending.

If a package.json contains "type":"module" all files with ".js" will throw an error if they are imported with an require function.

This fix:

This solves #801

changeset-bot[bot] commented 3 years ago

⚠️ No Changeset found

Latest commit: 8d18bf2649dac10708969d2c3a596ffde2b728b1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

developit commented 3 years ago

Hiya - sorry for the delay on this PR, ~I'm actually thinking we might be better off detecting this and warning, rather than relying on docs~ ... I'm silly, and you already did this. Cheers!

JounQin commented 3 years ago

@developit There is no changeset generated for this PR.

jeffryang24 commented 3 years ago

Hmm.. Can't wait this change to be published... :bow:

developit commented 3 years ago

This is published.