Browse Source

Add type application/javascript when initializing Worker

feature/aio
Jerome Wu 6 years ago
parent
commit
3450e28087
  1. 8
      src/browser/index.js

8
src/browser/index.js

@ -98,9 +98,11 @@ exports.defaultOptions = { @@ -98,9 +98,11 @@ exports.defaultOptions = {
*/
exports.spawnWorker = (instance, { workerPath }) => {
let worker;
if (window.Blob && window.URL) {
const blob = new Blob([`importScripts("${workerPath}");`]);
worker = new Worker(window.URL.createObjectURL(blob));
if (Blob && URL) {
const blob = new Blob([`importScripts("${workerPath}");`], {
type: 'application/javascript',
});
worker = new Worker(URL.createObjectURL(blob));
} else {
worker = new Worker(workerPath);
}

Loading…
Cancel
Save