surma/rollup-plugin-off-main-thread

publicPath option

staabm opened this issue · 2 comments

it seems this plugin - while beeing announced as the successfor from loadz0r - does not support the publicPath as loadz0r did

https://github.com/surma/rollup-plugin-loadz0r/pull/11/files

was this removed intentionally or is it just missing right now? or maybe it was renamend and I just missed it?

Looks like it is missing from this plugin. https://github.com/surma/rollup-plugin-loadz0r/blob/master/loader.ejs#L28 and https://github.com/surma/rollup-plugin-loadz0r/blob/master/loader.ejs#L68 are where it was used in loadz0r, but it looks like it was removed, intentionally or not. Should be as simple as adding the parameter to the default options (although I guess that's not necessary) and then copying in the above lines.

As a workaround, you should be able to pass in your publicPath param as you did in loadz0r, then pass your own custom loader.ejs in the loader param that uses publicPath. You could probably even copy the one from loadz0r verbatim.

0xd61 commented

With the import as URL option I was able to solve this issue by changing the URL after the import:

import workerURL from "omt:./worker.js";
let newURL = `./somePath/${workerURL}`

const worker = new Worker(newURL, { name: "main-worker" });