GitHub repo
I’m using Rollup to include npm packages in my content scripts.
Recreate issue:
- Clone the repo
pnpm install
pnpm run rollup-build
pnpm run dev
- If the ext works as expected, you’ll see the codeblocks’ background color turns to black. Instead, you’ll see this message in the console:
TypeError: error loading dynamically imported module: https://stackoverflow.com/questions/76319880/wasm-CR5DIDIU.js
I don’t know exactly what caused this error, but this only happens when Rollup bundles code into multiple chunks.
I can instead configure rollup.config.js
to bundles into one single big file like this:
From
{
dir: 'dist',
}
to
{
file: 'dist/content.js',
format: 'iife',
inlineDynamicImports: true
}
Rollup will instead create one single file, the error disappears, and my ext works as expected in development. However the output file would be too big and I can’t sign the extension:
"This file is not binary and is too large to parse. Files larger than 4MB will not be parsed. Consider moving large lists of data out of JavaScript files and into JSON files, or splitting very large files into smaller ones.
So I think I have to keep the multiple chunks, but I have no idea how to fix the dynamically imported
error. What should I try?