chrisinajar / craco-worker-loader

Simple worker loader configuration for react-scripts using craco
MIT License
0 stars 1 forks source link

Multiple assets emit different content to the same filename static/js/bundle.worker.js #2

Open kbi-daniel opened 4 years ago

kbi-daniel commented 4 years ago

In development mode, as soon as I add more than one web worker, I get the warning: "Multiple assets emit different content to the same filename static/js/bundle.worker.js". It seems like my two web workers are both trying to write to the same bundle.worker.js file.

Screen Shot 2020-08-23 at 1 00 55 PM

Alternatively, when performing a production build, everything seems to work fine and Webpack seems to understand that the two workers should be separate and places them in two different bundles.

Screen Shot 2020-08-23 at 12 57 54 PM

Is there a way to configure this plugin so that Webpack knows to separate the web workers in different file bundles while in dev mode?

kbi-daniel commented 4 years ago

For what it's worth, I was able to get rid of this warning by adding the following filename option to the worker-loader rule.

Screen Shot 2020-08-23 at 2 33 16 PM
captainkovalsky commented 3 years ago

@kbi-daniel btw, did you try to use worker-loader with typescript?