Skip to content

Interoperability with WMR #40

Open
@aduh95

Description

@aduh95

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.

I can work around this by changing this line

if (format === "esm" || format === "es") {
to

if (format === "esm" || format === "es" || format === undefined) {

Is interoperability with WMR something on the roadmap?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions