-
Notifications
You must be signed in to change notification settings - Fork 126
Conversation
Would it be appropriate to warn users in this situation? It may be that we're dealing with external packages, in which case the user may have limited control, but it might help people understand that their Babel config is messed up etc |
messed up? does this mean it’s somehow not working as intended? why? |
@flying-sheep Messed up as in Babel is being used to convert ES6 modules to CommonJS modules, which means Rollup has to convert them back to ES6 modules so that it can bundle them (quite possibly in order to generate a CommonJS bundle). Keeping everything as ES6 until you need to run it is the name of the game. |
ok, but how? i’ll comment in rollup/rollup#337 about it. for this issue and plugin, i think we should simply detect the most common ways stuff is distributed and be practical instead of idealistic. this is a practical plugin, written for a world of commonjs modules. it should “get” as many of them as possible. |
Should have been more specific – I meant keeping everything as ES6 modules is the goal, since that's the only thing that's getting translated back and forth otherwise. |
makes sense. this is a frequent language confusion in the discussions here. but still: both should be supported as we can’t hope to convince everyone to use
then we can actually work productively with rollup as node_modules bundler |
Looks good to me. 👍 |
Add support for transpiled modules
Have released this as 2.0.0 (since it's technically a breaking change) – it doesn't include warnings about already-transpiled modules, but we could revisit that in future if we choose |
Sorry, I think this change is indeed breaking support of rollup modules in browserify/babel. If you export |
Don't merge yet
This PR tracks how best to handle CommonJS modules that have already been transpiled by Babel, TypeScript or something similar. These CommonJS modules define a
__esModule
property on their exports object, and export their default export as adefault
property.We should:
__esModule
propertydefault
property for the default export instead of themodule.exports
objectFixes #10