-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
Chunked code runs in wrong order #5142
Comments
Another case, possible with the same cause, is when using iron-icon from https://github.com/PolymerElements/iron-icon/blob/v3.0.1/iron-icon.js This imports iron-meta https://github.com/PolymerElements/iron-icon/blob/v3.0.1/iron-icon.js#L13 iron-meta.js defines a custom element https://github.com/PolymerElements/iron-meta/blob/v3.0.1/iron-meta.js#L135 Yet when iron-icon creates a I was not able to create a reduced test case for this one but it reproduces in one of our application. |
@patak-js Hi, this issue is very important for us to get Vite integration working at Vaadin. The problem appears to be quite severe: running code in the wrong order may cause unpredictable consequences. |
I'm not sure it's a bug of Vite. If you just switch these two lines. And it works. Maybe the cause it's the difference of "import order" between cjs and esm. |
A simplified test is
|
Now what happens in the browser is polymer-legacy.js. becomes
The chunk The common dependency, which absolutely must be run before, is included in the chunk
and that is executed last |
My reproduction and the result is the same with @Artur-
|
Minimal reproducible example with esbuild:
Maybe related: evanw/esbuild#399 |
Describe the bug
With suitable imports, it seems that the following code
can execute so that
observedAttributes
is run before the globalJSCompiler_renameProperty
has been set, resulting inThis only happens with some specific imports, as shown in the test case.
Reproduction
Open localhost:3000 and look at the console output. There should be no errors.
System Info
System: OS: macOS 11.6 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 290.42 MB / 32.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 16.9.1 - /usr/local/bin/node Yarn: 1.22.11 - /usr/local/bin/yarn npm: 7.21.1 - /usr/local/bin/npm Watchman: 2021.09.13.00 - /usr/local/bin/watchman Browsers: Brave Browser: 93.1.29.81 Chrome: 94.0.4606.61 Chrome Canary: 96.0.4656.3 Firefox: 92.0 Safari: 15.0 Safari Technology Preview: 15.4 npmPackages: vite: ^2.5.4 => 2.6.0
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: