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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix registration or JS singletons across modules #1605

Open
sabina-talipova opened this issue Oct 17, 2023 · 0 comments
Open

Fix registration or JS singletons across modules #1605

sabina-talipova opened this issue Oct 17, 2023 · 0 comments

Comments

@sabina-talipova
Copy link
Contributor

sabina-talipova commented Oct 17, 2023

Description

We're assigning an instances to the ss namespace because singletons only the context on a single Browserify bundle. For example - the lib bundle exposes a singleton called router. If the framework imports router, as an external dependency, then all modules in framework will get the same copy of register when importing it.
Likewise if the custom bundle imports router as an external dependency, all modules in custom will get the same copy of router. This works as expected within the context of one bundle, all modules in that bundle importing router get the exact same copy, a singleton. However this is not true across bundles. While all modules in framework get a single copy of router and all modules in custom get a single copy of router, the copy of router in framework is not the same copy of router available in custom.
See SystemJS as a solution https://github.com/systemjs/systemjs

See:

@GuySartorelli GuySartorelli changed the title TODO: window.ss - Fix registration across modules Fix registration or JS singletons across modules Oct 25, 2023
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

1 participant