-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
fix(commonjs): __moduleExports in multi entry + inter dependencies #415
fix(commonjs): __moduleExports in multi entry + inter dependencies #415
Conversation
419c379
to
001a71d
Compare
@danielgindi please have a peek at that snapshot when you have the chance and then we'll merge |
I'm also gonna have a small peek in a second |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two comments, and I am also missing the updated snapshots in the markdown file, did you commit this?
var input1 = 1; | ||
|
||
export default input1; | ||
export { input1 as __moduleExports }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you said we cannot get rid of __moduleExports
because it will trigger interop handlers when using the default
export? The thing is, this will now taint entry points in a way that users will notice there is suddenly a new named export that does not belong here. So one could wonder if for entry points, we might rather use the default even though it triggers interop? But I am undecided, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well this only happens for entry points that are being imported by other code paths in the bundle.
So in most use cases - it will not be exported.
And in the use cases where it does - it's due to its use by one of the other entry points.
Unfortunately I don't see any way around it without breaking code... But if I think of some other trick to get rid of this, I'll make a PR :-)
4ca9019
to
6a7ba9d
Compare
6a7ba9d
to
322de1d
Compare
I'm having issues with |
I'm not sure about the But yes, test output should not be covered by prettier. Did you try extending the |
This is great, thank you @danielgindi! |
…ollup#415) * fix(commonjs): __moduleExports in multi entry + inter dependencies * Added form tests outputs to .prettierignore
Rollup Plugin Name:
commonjs
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers: #411
Description
When a module is a main entry point but still imported by another module (due to multiple entries feature), we can now detect that and properly export
__moduleExports
.Tests
I've had to modify the form tester to support multi-entry situations. (In the function tester it does not make a lot of sense as we run the code in memory where it would expect to have other generated outputs to exist on disk for importing).