Closed tjaartvdwalt closed 8 years ago
Does that happen through the script filename?
No, browserify-shim doesn't load your scripts when you use globals. Script loading is left up to you. You're just telling it that the script publishes itself as window.THREE
.
how do I link scripts that do not explicitly have a filename?
Same deal, you use globals and load yourself. But you should try load-google-maps instead of shimming.
Does this answer your question?
Thanks for the quick answer. I will have a look at load-google-maps
.
Just to close of this issue, I do not have total clarity yet. If we look at the example:
"browserify-shim": {
"three": "global:THREE"
}
How does browserify-shim
know which script the key "three"
matches to?
How does browserify-shim know which script the key "three" matches to?
It doesn't. It's your job to add the tag so window.THREE
is defined before your bundle is evaluated.
ah ok, now I get it. Thanks
Hi, I need someone please point me in the right direction.
It seems to be a really clean solution to expose global variables through the shim config.
Something I do not completely understand is how the script defined in the
<scripts>
tag is linked to thebrowserify-shim
configuration? Does that happen through the script filename?In the documentation example, does the
"three"
in the"browserify-shim"
config match the filethree.min.js
in the<script>
tag?If this understanding is correct, how do I link scripts that do not explicitly have a filename? A good example for me would be the Google Maps API.
Here is an example of what I would like to achieve: