GoogleChromeLabs/worker-plugin

Handle import.meta.url

developit opened this issue · 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.