Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

What does global context mean? #50

Open
ghuser opened this issue Jan 23, 2018 · 3 comments
Open

What does global context mean? #50

ghuser opened this issue Jan 23, 2018 · 3 comments

Comments

@ghuser
Copy link

ghuser commented Jan 23, 2018

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.

@alexander-akait
Copy link
Member

@ghuser var foo = "bar"; function () { console.log(var); } inside myScript.js

@enriquez
Copy link

@ghuser Is your script in strict mode? I was having the same issue, give #51 a try.

@FilippoPolo
Copy link

If it is due to "use strict", the version that's currently on master should work. However, there's no release yet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants