You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 19, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 19, 2026. It is now read-only.
I wanted to create an npm package that internally uses web worker. I got working configuration for that in the worker-loader package for webpack as follows.
then I could use my library in some react project like that
import {BoardGenerator} from '@yufuzu/shipbattle-board';
const generator = new BoardGenerator();
Board generator is my npm library that uses it's web worker.
When I switched to this plugin I get an error that it cannot find web worker. Everything compiles properly and I am able to see use it in live mode in the browser. (From this project npm start). Problem occurs only when I import that library in some other project.
I appreciate your work for using webworker with module imports. Any plans of supporting web workers that are imported from node_modules lib. Now there are two libraries: worker-loader Works imported from node_modules, by inline:true, but no web worker type: module supported worker-plugin supports worker type: module, but but not inlining as plugin above :(
I wish to switch from worker-loader to this plugin for module importing support in web workers but I stuck
Bundling a worker to a data URI is generally not a good idea. It's putting extra strain on the parser in the main thread for no reason.
I'm not sure there is a reasonable way to make this work - webpack's output isn't really designed to be nested inside another Webpack bundle, it breaks things like pathing.
Im running in the same issue with a library I published some time ago. Worker-loader is failing to recognize the inline option so I had to move to worker-plugin, but I'm still not being able to get it to a working state. Is there any way to mirror worker-loader's inline method ?
Activity
mmwo commentedon Feb 11, 2019
I appreciate your work for using webworker with module imports. Any plans of supporting web workers that are imported from node_modules lib. Now there are two libraries:
worker-loaderWorks imported from node_modules, byinline:true, but no web workertype: modulesupportedworker-pluginsupports workertype: module, but but not inlining as plugin above :(I wish to switch from worker-loader to this plugin for module importing support in web workers but I stuck
developit commentedon Feb 19, 2019
Bundling a worker to a data URI is generally not a good idea. It's putting extra strain on the parser in the main thread for no reason.
I'm not sure there is a reasonable way to make this work - webpack's output isn't really designed to be nested inside another Webpack bundle, it breaks things like pathing.
altinselimi commentedon Nov 5, 2019
Im running in the same issue with a library I published some time ago. Worker-loader is failing to recognize the inline option so I had to move to worker-plugin, but I'm still not being able to get it to a working state. Is there any way to mirror worker-loader's inline method ?
Repo: https://github.com/altinselimi/kalendar/tree/worker-plugin
maksnester commentedon May 12, 2020
So what would be the right way of creating an npm library with a builtin web worker?
altinselimi commentedon May 12, 2020
@maksnester rollup as a bundler. Check out my kalendar repo for an example.