worker-plugin icon indicating copy to clipboard operation
worker-plugin copied to clipboard

Handle import.meta.url

Open developit opened this issue 5 years ago • 0 comments

It should be possible to apply a pre/pitching loader to all files that transforms import.meta.url to __filename. This would allow correct Worker URL creation (solving #31) using URL:

const url = new URL('./my-worker.js', import.meta.url);
const worker = new Worker(url, { type: 'module' });

I believe Webpack's simple partial evaluation should be enough to consider this a "static" URL under the current logic.

developit avatar Apr 17 '20 17:04 developit