Skip to content

Conversation

@aheissenberger
Copy link
Contributor

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:

  • will strip .cjs when creating the base name
  • switch from default extension .js to .cjs when "type":"module" exists in package.json
  • update documentation to highlight the problem

This solves #801

@changeset-bot
Copy link

changeset-bot bot commented Feb 4, 2021

⚠️ No Changeset found

Latest commit: 8d18bf2

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
Copy link
Owner

developit commented May 5, 2021

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!

@developit developit self-requested a review May 5, 2021 15:43
@developit developit merged commit a7f7265 into developit:master May 5, 2021
@JounQin
Copy link
Contributor

JounQin commented May 6, 2021

@developit There is no changeset generated for this PR.

@jeffryang24
Copy link

Hmm.. Can't wait this change to be published... 🙇

@developit
Copy link
Owner

This is published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants