Debug webpack worker-loader in VSCode or WebStorm

Viewed 165

I have a couple of files that are defined as workers using the webpack worker-loader module as such:

{
    test: /\.worker\.(ts|js)x?$/,
    exclude: /node_modules/,
    use: [
        'worker-loader',
    ],
},

When I put a breakpoint to debug the worker in VSCode, it catches the file with the path to the bundle.worker.js instead of the source file:

export default function Worker_fn() {
  return new Worker(__webpack_public_path__ + "bundle.worker.js");
}

So is there a way in VSCode to map bundle.worker.js to the source files to debug properly?

0 Answers
Related