Make script loader Web Worker friendly

Since `window` is not accessible in a Web Worker context, code like:
`require("script!myModule.js”);` will not work