webpack-contrib / webpack-bundle-analyzer

Webpack plugin and CLI utility that represents bundle content as convenient interactive zoomable treemap
MIT License
12.58k stars 488 forks source link

Using WebWorkerChunkTemplatePlugin generates modules in an unrecognized way #351

Closed Gongreg closed 4 years ago

Gongreg commented 4 years ago

Issue description

While working using webpack for web-worker with chunks WebWorkerChunkTemplatePlugin The source is created in this format:

source.add(
    `${globalObject}[${JSON.stringify(
        chunkCallbackName
    )}](${JSON.stringify(chunk.ids)},`
);

So:

self["chunkCallbackName"]([9],{

or

self.chunkCallbackName([9],{ 

when the code is minified.

There should be a check for this.

valscion commented 4 years ago

PR is welcome :relaxed: