Open aduh95 opened 3 years ago
It seems currently not possible to use this plugin with WMR:
yarn create wmr your-project-name cd your-project-name yarn add --dev @surma/rollup-plugin-off-main-thread echo 'import OMT from "@surma/rollup-plugin-off-main-thread";' > wmr.config.mjs echo 'export default async function (config) {' >> wmr.config.mjs echo 'config.plugins.push(OMT());' >> wmr.config.mjs echo '}' >> wmr.config.mjs echo 'new Worker(new URL("./worker.js", import.meta.url), {type:"module"});' > public/pages/home/index.js echo 'export default function Home() { return <div>Home</div>; }' >> public/pages/home/index.js echo 'console.log("Worker working")' > public/pages/home/worker.js yarn wmr build
This produces the following error:
`output.format` must either be "amd" or "esm", got "undefined"
I've tried to change the format in wmr.config.mjs but didn't get much luck.
wmr.config.mjs
I can work around this by changing this line https://github.com/surma/rollup-plugin-off-main-thread/blob/0dc070bffac2cdde9fd85ef24010415d87186e86/index.js#L204 to
if (format === "esm" || format === "es" || format === undefined) {
Is interoperability with WMR something on the roadmap?
@developit wdyt?
I have a demo of this somewhere, I'll dig it up. Using it in WMR requires a bit of tweaking because it needs to use Module Workers directly in development mode.
It seems currently not possible to use this plugin with WMR:
This produces the following error:
I've tried to change the format in
wmr.config.mjs
but didn't get much luck.I can work around this by changing this line https://github.com/surma/rollup-plugin-off-main-thread/blob/0dc070bffac2cdde9fd85ef24010415d87186e86/index.js#L204 to
Is interoperability with WMR something on the roadmap?