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 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
Description
We're assigning an instances to the
ss
namespace because singletons only the context on a single Browserify bundle. For example - thelib
bundle exposes a singleton calledrouter
. If theframework
importsrouter
, as an external dependency, then all modules inframework
will get the same copy ofregister
when importing it.Likewise if the
custom
bundle importsrouter
as an external dependency, all modules incustom
will get the same copy ofrouter
. This works as expected within the context of one bundle, all modules in that bundle importingrouter
get the exact same copy, a singleton. However this is not true across bundles. While all modules inframework
get a single copy ofrouter
and all modules incustom
get a single copy ofrouter
, the copy ofrouter
inframework
is not the same copy ofrouter
available incustom
.See SystemJS as a solution https://github.com/systemjs/systemjs
See:
silverstripe-admin/client/src/lib/ReactRouteRegister.js
Line 173 in 0f18b3d
silverstripe-admin/client/src/lib/Router.js
Line 119 in e3d9e1d
silverstripe-admin/client/src/lib/TinyMCEActionRegistrar.js
Line 150 in 0f18b3d
The text was updated successfully, but these errors were encountered: