You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're currently assigning instances we wish to use as singletons to the ss namespace.
This is because singletons (exported by ES6 modules) only work within the context of a single Browserify bundle.
For context this is what I mean by an ES6 singleton.
Let's assume the lib bundle exposes singleton so other bundles can require it, as an external, at runtime. If the framework bundle imports the external singleton dependency, then all modules in the framework bundle will have access the same copy of singleton if they import it.
Likewise if the custom bundle imports singleton as an external dependency, all modules in custom will get the same copy of singleton.
This works as expected within the context of one bundle but does not work across bundles. The copy of singleton that framework gets is not the same copy of singleton that custom gets.
We're currently assigning instances we wish to use as singletons to the
ss
namespace.This is because singletons (exported by ES6 modules) only work within the context of a
single Browserify bundle.
For context this is what I mean by an ES6 singleton.
singleton.js
Let's assume the
lib
bundle exposessingleton
so other bundles can require it, as an external, at runtime. If theframework
bundle imports the externalsingleton
dependency, then all modules in theframework
bundle will have access the same copy ofsingleton
if they import it.Likewise if the
custom
bundle importssingleton
as an external dependency, all modules incustom
will get the same copy ofsingleton
.This works as expected within the context of one bundle but does not work across bundles. The copy of
singleton
thatframework
gets is not the same copy ofsingleton
thatcustom
gets.Possible solutions:
The text was updated successfully, but these errors were encountered: