script-loader
script-loader copied to clipboard
What does global context mean?
I would expect that this loader executes script myScript.js
as if it was included with <script src="myScript.js">
. This is not the case.
The following statement var myVar = {}
will not add myVar as global (in contrast to how <script src="myScript.js">
behaves) . So in the html page: console.log(myVar)
will print undefined.
@ghuser var foo = "bar"; function () { console.log(var); }
inside myScript.js
@ghuser Is your script in strict mode? I was having the same issue, give #51 a try.
If it is due to "use strict", the version that's currently on master should work. However, there's no release yet.