-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Module execution order is wrong with shared bundles #5659
Labels
Comments
Another instance of this: console.log("b");
require("./c.js"); behaves like import "./c.js";
console.log("b"); if c.js is in a shared bundle |
Another symptom of this: some assets can be executed multiple times 💻 Code Sample// index.js
import("./async1.js");
function a() {
import("./async2.js");
}
function b() {
import("./async3.js");
}
// async1.js
import "./u.js";
import "./v.js";
// async2.js
import "./u.js";
// async3.js
import "./v.js";
// u.js
import "./w.js";
console.log("u")
/*
padding to reach size of 2198 bytes
*/
// v.js
import "./w.js";
console.log("v")
/*
padding to reach size of 2198 bytes
*/
// w.js
console.log("w"); and
Output is:
💻 Code Sample// index.js
import("./async1.js");
import("./async2.js");
// async1.js
import "./v.js";
// async2.js
import "./v.js";
// v.js
console.log("v") and
Output is
|
Actually also related: #5064 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🐛 bug report
Shared bundles currently hoist imports, so they aren't executed interleaved with the importing bundle.
Fixing this would also fix rollup/rollup#3888 for us. Also add a test for that!
🤔 Expected Behavior
Prints:
😯 Current Behavior
The current Rollup behaviour is also wrong
Prints:
💁 Possible Solution
Wrap assets in shared bundles
Some ressources:
💻 Code Sample
🌍 Your Environment
The text was updated successfully, but these errors were encountered: