Webpack generating [hash].worker.js file when packaging custom library Webpack generating [hash].worker.js file when packaging custom library reactjs reactjs

Webpack generating [hash].worker.js file when packaging custom library


You might try using the worker-loader plugin with inline to handle the bundling -

rules: [      ...      {        test: /\.worker\.js$/,        use: {           loader: 'worker-loader',           options: { inline: true, fallback: false }        }      }    ]

That said, there are several open issues on Github surrounding using the worker as a blob, so YMMV


Actually if you are using webpack 3 and above, chunking of the bundle is automatically done for you. In the SplitChunks Plugin documentation here it is actually stated how this behaves.

So because of this you might need to scan your code and check for this conditions. Also it's good to know if you are asynchrously importing the some module? That might signal webpack to make it into a separate chunk.