-
-
Notifications
You must be signed in to change notification settings - Fork 591
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
[@rollup/plugin-commonjs] Cannot handle CJS -> ESM imports #400
Comments
@FredKSchott would love to review a PR for this. AFAIK we have no active maintainers for commonjs other than @danielgindi who has occasional time on the plugin. |
Also - when importing the real |
no problem, happy to clarify:
|
Okay really get what you said in the issue description now. The I think that this behavior is expected. That the You can read about some of the issues with this interop/hack here: webpack/webpack#7973 And I'm mentioning webpack, because we are following the same interop standard that babel have founded. In theory, if you used To sum up: I think that this can be closed. |
Apparently it challenged me and I just had to try it. Dammit. So there's a PR now. |
Hahaha nice! |
@FredKSchott I'm f'ed up like that... ;-) |
I think I've been running into the same issue this morning. Made another repro case where the named exports are pulled off of the default: https://repl.it/@marvinhagemeist/UntidyWiryConditionals Actual: var styledComponents = require('styled-components');
var styledComponents__default = _interopDefault(styledComponents);
// ... snip
exports.reset = styledComponents__default.css(`
* { box-sizing: border-box; }
`); Expected: var styledComponents = require('styled-components');
var styledComponents__default = _interopDefault(styledComponents);
// ... snip
exports.reset = styledComponents.css(`
* { box-sizing: border-box; }
`); |
I started #481 to move all interop issues including this one forward. |
How Do We Reproduce?
Expected Behavior
css
andcreateGlobalStyle
are imported correctly.Actual Behavior
(Looking at output/bundle.js)
css
andcreateGlobalStyle
are being pulled off of the default export (any empty object) instead of the module namespace (where they exist as exports).See: https://www.pika.dev/npm/snowpack/discuss/194
The text was updated successfully, but these errors were encountered: