Skip to content

Instantly share code, notes, and snippets.

@adamjmcgrath
Created May 2, 2020 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamjmcgrath/fbc6b1a0991f98fa9ca13bef92bc825b to your computer and use it in GitHub Desktop.
Save adamjmcgrath/fbc6b1a0991f98fa9ca13bef92bc825b to your computer and use it in GitHub Desktop.
rollup plugin warning

run npm start

$ rollup -c && webpack rolled-up.js

> tmp-rollup-webpack@1.0.0 start /dev/tmp-rollup-webpack
> rollup -c && webpack rolled-up.js


index.js → rolled-up.js...
created rolled-up.js in 31ms
Hash: 77d134ef0777e5fa1641
Version: webpack 4.43.0
Time: 125ms
Built at: 05/02/2020 8:00:43 AM
  Asset    Size  Chunks             Chunk Names
main.js  69 KiB    main  [emitted]  main
Entrypoint main = main.js
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 472 bytes {main} [built]
[./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {main} [built]
[./rolled-up.js] 2.81 KiB {main} [built]
    + 5 hidden modules

WARNING in ./rolled-up.js
Module not found: Error: Can't resolve 'worker_threads' in '/dev/tmp-rollup-webpack'
 @ ./rolled-up.js
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"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"rollup": "^2.7.2",
"webpack": "^4.43.0",
"rollup-plugin-web-worker-loader": "git+https://git@github.com/darionco/rollup-plugin-web-worker-loader.git",
"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: 'web',
devtool: false,
};
console.log('foo');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment