I have a Vite setup and try to load the extension into Firefox. Before that, I had to rename background.service_worker into background.scripts in the Manifest:
But after building the extension and loading it, I get this when inspecting:
Uncaught SyntaxError: import declarations may only appear at top level of a module
The problem points to this line in my service-worker-loader.js (and this is a file with 1 import only):
import './assets/background.ts.c2a7eff0.js';
My best guess so far is that type: "module" property of background is ignored by Firefox, so the script doesn't support imports. Probably it wants a single file with everything bundled into it.
So is it possible to configure CRXJS to produce only 1 file for service worker and content script? Or maybe there's another solution to my case?
Thanks
Reproduction
My repo is private, yet I can create a demo example if you need it
Build tool
Rollup
Where do you see the problem?
Describe the bug
Hi,
I have a Vite setup and try to load the extension into Firefox. Before that, I had to rename
background.service_worker
intobackground.scripts
in the Manifest:But after building the extension and loading it, I get this when inspecting:
The problem points to this line in my
service-worker-loader.js
(and this is a file with 1 import only):My best guess so far is that
type: "module"
property ofbackground
is ignored by Firefox, so the script doesn't support imports. Probably it wants a single file with everything bundled into it.So is it possible to configure CRXJS to produce only 1 file for service worker and content script? Or maybe there's another solution to my case?
Thanks
Reproduction
My repo is private, yet I can create a demo example if you need it
Logs
No response
System Info
Severity
annoyance