-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Bare imports should always be executed first #2598
Comments
Note that this problem also exists in Rollup. |
I checked #399 but since it mentioned multiple entry points I wasn't sure if this was a different issue or not 🤔 |
seems you can't specify the order of execution of ecma modules per spec |
you can keep your polyfill while delay the run ofpiece of code that depends on it (e.g. lazy evaluation) |
Yes, that's what I currently do, but it's not ideal: the browser has to finish executing polyfills before even starting to fetch the actual application. It adds a small delay and indirection; I'm a little worried a browser will eventually show a white flash on reload if the delay is long enough. |
<!-- Thank you for contributing! --> ### Description This feature try to solve the execution order problem caused by rollup and esbuild's code splitting logic. The nature of these problem is that the execution order of shared modules are hoisted unexpectedly. - evanw/esbuild#399 - evanw/esbuild#2598 This is done by adding helper function to simulate the original the semantic esm input while keep the static linking between modules. <!-- Please insert your description here and provide especially info about the "what" this PR is solving -->
Consider the following code:
Esbuild inlines
./polyfill
, causing the file to turn into:This is invalid, as it means that the polyfill won't be available inside
chunk-EN3LV7DE
, causing the output to crash.Esbuild should at least assume that the bare import, having no imported symbols, must have a significance in terms of side-effects and ensure that it gets evaluated at the right time.
The text was updated successfully, but these errors were encountered: