Questions tagged [worker-loader]

Use this tag for questions relating to loading WebWorkers in Webpack using worker-loader.

36 questions
13
votes
1 answer

Unexpected '!' in 'worker-loader!mapbox-gl/dist/mapbox-gl-csp-worker'

hi I'm trying to use mapbox-gl in React with this tutorial. and I'm getting this error : Unexpected '!' in 'worker-loader!mapbox-gl/dist/mapbox-gl-csp-worker' while importing "worker-loader!mapbox-gl/dist/mapbox-gl-csp-worker" here is my important…
Marzieh Mahdavi
  • 153
  • 1
  • 6
13
votes
2 answers

Webpack worker-loader fails to compile typescript worker

I am configuring my project as described in worker-loader documentation and I was able to get TS code intel working using the correct d.ts. However, during webpack build it throws an error and I don't understand why. ERROR in…
Dmitry Matveev
  • 5,320
  • 1
  • 32
  • 43
10
votes
2 answers

How to load web worker using webpack's worker loader

I'm trying to load a web worker script into my React application by using webpack's worker loader. However, I get a module not found error. ERROR in ./src/index.js Module not found: Error: Can't resolve './file.worker' in…
user3549254
  • 101
  • 1
  • 1
  • 5
9
votes
2 answers

Using webpack worker-loader with typescript causes cannot find module error

I've been using the webpack webworker loader for a while now. And we're now migrating to Angular 7 and started using typescript. After following many guides and tuturials and this amazing issue…
Samantha Adrichem
  • 833
  • 1
  • 12
  • 23
8
votes
1 answer

Service worker won't install when I try to cache xxx.worker.js

I have the following service worker code in my Vue app: main.js if (navigator.serviceWorker) { navigator.serviceWorker.register('/service-worker.js').catch(function() { console.log('Service worker registration failed.'); …
Adam Zerner
  • 17,797
  • 15
  • 90
  • 156
7
votes
1 answer

how to config create react app with worker-loader

I need to create an CRA(create-react-app) app with multiple workers. As an example (my workers include import modules): // worker.js import x from 'file-xxx.js' addEventListener('message', e => { // ... }) // App.jsx App(){ const mWorker =…
6
votes
2 answers

Service Workers with Vue and Bundling

I use Vue 2 with Common.js to generate an AMD Bundle. I need to be able to automatically register my service worker on runtime. Something that works: https://www.npmjs.com/package/worker-plugin https://www.npmjs.com/package/worker-loader The reason…
Asperger
  • 3,064
  • 8
  • 52
  • 100
4
votes
1 answer

What Does worker-loader Inline Do?

My understanding was that the following Webpack worker-loader config: ... module: { rules: [ { test: /worker\.js/, loader: "worker-loader", options: { inline: 'fallback', } …
AlexOlsen
  • 187
  • 2
  • 10
4
votes
2 answers

Web Worker not working when importing module, even while using worker-loader

I'm trying to make a web worker to prevent stalling the React main thread. The worker is supposed to read an image and do various things. The app was created using create-react-app. Currently I have webpack.config.js module.exports = { …
cclloyd
  • 8,171
  • 16
  • 57
  • 104
4
votes
1 answer

Unable to bundle a Web Worker to be imported like an NPM package

My goal is to be able to publish a Web Worker NPM package which can be imported normally (import MyPkg from 'my-pkg') without requiring the user to import it with worker-loader (inline or otherwise) To accomplish this, I've tried using a Babel build…
4
votes
1 answer

How to use Web Workers in create-react-app with worker-loader?

I am trying to implement Web Workers in my React app to share a single WebSockets connection over multiple tabs. I use the worker-loader dependency for loading in Web Workers. Unfortunately i can't even get a simple dedicated web worker to work. …
Maikkeyy
  • 1,017
  • 1
  • 11
  • 18
3
votes
0 answers

bundle web workers as integral part of npm package with single file webpack output

I am writing an npm package which is a plugin for the popular library leafletjs. I am using webpack to bundle the package. I want this package to be able to spawn and destroy some web workers on command. The web worker code is part of my source…
Seth Lutske
  • 9,154
  • 5
  • 29
  • 78
3
votes
1 answer

Webpack worker-loader versus worker-plugin

What are the benefits of using worker-plugin compared to worker-loader for workers in webpack, and why? Which one is better?
Ethanol
  • 370
  • 6
  • 18
3
votes
0 answers

Adding worker-loader breaks Webpacker

I'm using worker-loader in a Rails / Webpacker setup. worker-loader is an easy way to use Web-workers in Webpack. yarn add worker-loader As per Webpacker instructions, I'm adding this loader to environments.js. environment.loaders.append('worker',…
GN.
  • 8,672
  • 10
  • 61
  • 126
2
votes
1 answer

Monaco Editor - Web Workers cannot be loaded in production build

I'm currently implementing the Monaco Editor from Microsoft (https://github.com/microsoft/monaco-editor), with a plugin for yaml validation, autocompletion, etc. . (https://github.com/remcohaszing/monaco-yaml) in our react js APP. Maybe it is…
1
2 3