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 |
lukastaegert
left a comment
There was a problem hiding this comment.
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.
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.
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:
commonjsThis 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).