run npm start
...
ReferenceError: Blob is not defined
...
import Worker from 'web-worker:./webworker.js'; | |
export default () => { | |
return new Worker(); | |
} |
{ | |
"name": "tmp-rollup-webpack", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"start": "rollup -c && webpack rolled-up.js && node dist/main.js" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"rollup": "^2.7.2", | |
"rollup-plugin-web-worker-loader": "^0.9.1", | |
"webpack": "^4.43.0" | |
}, | |
"devDependencies": { | |
"webpack-cli": "^3.3.11" | |
} | |
} |
import webWorkerLoader from 'rollup-plugin-web-worker-loader'; | |
export default { | |
input: 'index.js', | |
output: [ | |
{ | |
file: 'rolled-up.js', | |
format: 'commonjs', | |
}, | |
], | |
plugins: [ | |
webWorkerLoader() | |
], | |
} |
module.exports = { | |
mode: 'development', | |
target: 'node', | |
devtool: false, | |
}; |
console.log('foo'); |