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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parcel will duplicate modules across entry points #4890

Open
jakearchibald opened this issue Jul 14, 2020 · 2 comments
Open

Parcel will duplicate modules across entry points #4890

jakearchibald opened this issue Jul 14, 2020 · 2 comments

Comments

@jakearchibald
Copy link

jakearchibald commented Jul 14, 2020

馃悰 bug report

https://github.com/GoogleChromeLabs/tooling.report/tree/4159c1e7a96cd5052e86aeafc1ff214f556074a0/tests/output-module-formats/subtests/es-modules/parcel

In this example two entry points import a common module, and Parcel duplicates the module in each entry point, leading to out of sync state.

It seems like this was fixed in particular cases (#4302), but this example is a library (isLibrary is true), so there's no way to know if each entry point will be in its own realm or not.

I think the behaviour needs to change so Parcel only duplicates modules if it's sure that they stay in different realms, as in the entry points are HTML. Although, there may be cases where the developer still wants to opt out of this.

@jakearchibald
Copy link
Author

jakearchibald commented Jul 14, 2020

In the above test, if I change the engines to:

"engines": {
  "node": ">=12.x"
}

I still get duplication, and also some browser-specific polyfills which seems weird.

@mischnic
Copy link
Member

mischnic commented Jul 22, 2020

I feel like we need to have a different bundling strategy (in which other bundles can be loaded synchronously as in ESM) based on the output format (cjs & esm). (So as though isEntry is false, I think)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants