-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
v6 loading module in importmap twice #2349
Comments
I cloned the repo and saw the behavior. The problem is that in systemjs@5, loading a bundle with named registers via System.import resulted in the bundle module being an empty no-op, but in systemjs@6 we return the last named register in the file. So in the example code, This is a bug in systemjs that we should fix, but as a workaround you can add I'll have to think more about what a fix would look like for this - the systemjs registry usually ensures no duplicate instantiation by resolving all specifiers to URLs and then only instantiating the module for each url once. Named modules violate this by inserting modules into the registry that do not have URLs associated with them. Ideally, we'd somehow connect the named register name with the bundle URL, although it's not clear how that would happen. Another approach could be to mark the registration arrays to avoid double instantiation or something along those lines (a bit ugly). |
Fix released in https://github.com/systemjs/systemjs/releases/tag/6.10.3 |
Demonstration
demo with v5, which is ok, have two messages in console:
SystemJS bundle file loaded!
Nice to see you, world
Actual Behavior
When I update package to latest version (6.10.2) and run scripts:
npm run deploy
npm run www
In browser (
http://localhost:3000/
) I have doubled message:Nice to see you, world _bundle-system.js 48:21_
SystemJS bundle file loaded! _index.js:6:12_
Nice to see you, world _bundle-system.js 48:21_
The text was updated successfully, but these errors were encountered: