Linked Questions

Popular Questions

How to create multiple web worker scripts using webpack?

Asked by At

By using import Worker from 'worker-loader!./worker.js' I know I can use a single worker script in my app, but what if I wanted to include another script? Would I add the new script to the test and run the build again.

module: {
    rules: [
        { test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" },
        {test: /\.worker\.js$/, use: { loader: 'worker-loader' }},
        {test: /\.newWorker\.js$/, use: { loader: 'worker-loader' }}
    ]
}

I tried the above, but it did not work.

Related Questions