Browser Global variable scope issues #52
Labels
bug
Something isn't working
help wanted
Extra attention is needed
question
Further information is requested
TLDR
We have issues with the global variable
SC
because we have now multiple packages which do not reuse the scope. We might want to see ES modules, as they are already supported in browsers through<script type="module"></script>
.I think that way we can use multiple packages in the browser. Will test soon.
test/esModules
branch. We might need it later.Edit: It's not so simple after all. UMD is not compatible with ES Modules just yet (see umdjs/umd#124 and umdjs/umd#134), so it ends up breaking anyway.
Long version
Since this is now a monorepo and we have multiple packages, importing them with the
script
tag withinhtml
will replace the global variableSC
every time. Seedemos
folder for example.There is an option that I don't like that much though, and I would rather find an alternative solution:
I don't like it because the individual bundles are already UMD, which in turn is compatible with browsers too. Having to do a single separate build, also UMD, seems like a waste.
Not sure if this is really urgent for now since it's only affecting the browser.
We should also take a look into ES modules: https://flaviocopes.com/es-modules/ because it might turn out to not be an issue at all when using them!
More info on ES modules:
https://www.ecma-international.org/ecma-262/6.0/#sec-modules
https://babeljs.io/docs/en/babel-preset-env#targetsesmodules
The text was updated successfully, but these errors were encountered: