{"action":"created","issue":{"url":"https://api.github.com/repos/systemjs/systemjs/issues/1153","repository_url":"https://api.github.com/repos/systemjs/systemjs","labels_url":"https://api.github.com/repos/systemjs/systemjs/issues/1153/labels{/name}","comments_url":"https://api.github.com/repos/systemjs/systemjs/issues/1153/comments","events_url":"https://api.github.com/repos/systemjs/systemjs/issues/1153/events","html_url":"https://github.com/systemjs/systemjs/issues/1153","id":139771031,"number":1153,"title":"Web Worker Blob - Uncaught Error: Uncaught TypeError: Failed to construct 'URL': Invalid URL","user":{"login":"shannonmpoole","id":1154610,"avatar_url":"https://avatars.githubusercontent.com/u/1154610?v=3","gravatar_id":"","url":"https://api.github.com/users/shannonmpoole","html_url":"https://github.com/shannonmpoole","followers_url":"https://api.github.com/users/shannonmpoole/followers","following_url":"https://api.github.com/users/shannonmpoole/following{/other_user}","gists_url":"https://api.github.com/users/shannonmpoole/gists{/gist_id}","starred_url":"https://api.github.com/users/shannonmpoole/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shannonmpoole/subscriptions","organizations_url":"https://api.github.com/users/shannonmpoole/orgs","repos_url":"https://api.github.com/users/shannonmpoole/repos","events_url":"https://api.github.com/users/shannonmpoole/events{/privacy}","received_events_url":"https://api.github.com/users/shannonmpoole/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/systemjs/systemjs/labels/bug","name":"bug","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-10T03:11:05Z","updated_at":"2016-03-29T14:50:48Z","closed_at":null,"body":"I know this is a weird edge case but I don't know how to solve it.\r\n\r\nIf you follow the example on [html5rocks](http://www.html5rocks.com/en/tutorials/workers/basics/#toc-inlineworkers) to inline a web worker you get the following error when you use importScripts to import the config after importing systemjs.\r\n\r\n```\r\nUncaught Error: Uncaught TypeError: Failed to construct 'URL': Invalid URL\r\n```\r\n\r\nFor example\r\n\r\n```\r\nvar blob = new Blob([\r\n            `self.onmessage = function(e) {\r\n                var opts = e.data;\r\n                if (opts.base) {\r\n                    importScripts(\\`\\${opts.base}\\${opts.packages}/system.js\\`);\r\n                    importScripts(\\`\\${opts.base}\\${opts.config}\\`); //<--throws error here\r\n                    delete self.onmessage;\r\n                }\r\n            };`\r\n        ]);\r\n\r\nvar worker = new Worker(URL.createObjectURL(blob));\r\nworker.postMessage({\r\n    base: document.baseURI,\r\n    packages: 'jspm_packages',\r\n    config: 'config.js'\r\n});\r\n```\r\n\r\nI suspect it has to do with the internal baseURI detection not working correctly for blobs. I've double checked and the url does end up being correct in the worker `importScripts('http://localhost:8080/config.js')`. I think the error message is coming from something internal and not that url but Chrome debugging for web workers has not really been allowing me to step through it correctly so I can't find it exactly.\r\n\r\nAny thoughts?"},"comment":{"url":"https://api.github.com/repos/systemjs/systemjs/issues/comments/202935854","html_url":"https://github.com/systemjs/systemjs/issues/1153#issuecomment-202935854","issue_url":"https://api.github.com/repos/systemjs/systemjs/issues/1153","id":202935854,"user":{"login":"shannonmpoole","id":1154610,"avatar_url":"https://avatars.githubusercontent.com/u/1154610?v=3","gravatar_id":"","url":"https://api.github.com/users/shannonmpoole","html_url":"https://github.com/shannonmpoole","followers_url":"https://api.github.com/users/shannonmpoole/followers","following_url":"https://api.github.com/users/shannonmpoole/following{/other_user}","gists_url":"https://api.github.com/users/shannonmpoole/gists{/gist_id}","starred_url":"https://api.github.com/users/shannonmpoole/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shannonmpoole/subscriptions","organizations_url":"https://api.github.com/users/shannonmpoole/orgs","repos_url":"https://api.github.com/users/shannonmpoole/repos","events_url":"https://api.github.com/users/shannonmpoole/events{/privacy}","received_events_url":"https://api.github.com/users/shannonmpoole/received_events","type":"User","site_admin":false},"created_at":"2016-03-29T14:50:48Z","updated_at":"2016-03-29T14:50:48Z","body":"@guybedford I originally tried to edit the baseURL in the config itself which didn't seem to have any affect. I also tried adding it to the worker before importing the config.\r\n\r\nFor example:\r\n```\r\nimportScripts('http://localhost:8080/jspm_packages/system.js');\r\nSystem.config({ baseURL: 'http://localhost:8080/' });\r\nimportScripts('http://localhost:8080/config.js'); //<--throws error here\r\n```\r\n\r\nI'm not sure how else to configure it."}}