Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to @rollup/plugin-commonjs v12+ #420

Closed
FredKSchott opened this issue Jun 4, 2020 · 0 comments · Fixed by #421
Closed

Upgrade to @rollup/plugin-commonjs v12+ #420

FredKSchott opened this issue Jun 4, 2020 · 0 comments · Fixed by #421
Assignees

Comments

@FredKSchott
Copy link
Owner

Rollup's Common.js plugin got a big update. It seems to solve a lot of issues around CJS<->ESM interop, which is great, but it also seems to be much more explicit about the fact that Common.js files only export a default export. This breaks packages like React, where their official docs say to use named exports (import {useState} from React), without any fallback like namedExports (that support was removed in v12).

Oddly enough, the advice in rollup/plugins#423 aligns with the work that we knew we needed to do anyway in #408. But then the question becomes: how far do we take this support?

  • We should really align with Node.js in getting serious about Common.js only using a single default export, but that would introduce a ton of issues for React users when all the React docs say to use multiple named exports.
  • Users migrating from Webpack will want their existing code to run, which may include named imports from CJS packages. We should support these users, at least in some sort of "loose" mode to help them migrate.
  • I hate to drop namedExport support outside of a major version bump, but it feels too soon to throw users a 3.0 version.
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 a pull request may close this issue.

1 participant