Failed to load extension
Error: Could not load javascript 'src/content.tsx' for content script.
Could not load manifest.
This happens because src/content.tsx obviously isn't a JavaScript file and the browser refuses to load it. In the manifest by CRXJS, src/content.tsx-loader.js is loaded instead and that's how it works.
Even if I manually change src/content.tsx in the dist folder to src/content.tsx-loader.js, I get chrome-extension://invalid/ errors because web_accessible_resources is empty.
My current solution is to load the package.json version and use that instead. However it'd be great if CRXJS handles this internally, so you don't get surprised like that. Being able to import the manifest is something I expect to work. Because there were no big flashing errors, it took quite a bit of time to debug.
Reproduction
Import the main mainfest.json file in your app code.
Build tool
Vite
Where do you see the problem?
Describe the bug
I want to output the extension version in my app, so I do this:
src/App.tsx:
This works out great, but it leads to
dist/manifest.json
getting overwritten. From this:…it turns to this (my original manifest file):
This leads to the following errors:
This happens because
src/content.tsx
obviously isn't a JavaScript file and the browser refuses to load it. In the manifest by CRXJS,src/content.tsx-loader.js
is loaded instead and that's how it works.src/content.tsx
in thedist
folder tosrc/content.tsx-loader.js
, I getchrome-extension://invalid/
errors becauseweb_accessible_resources
is empty.My current solution is to load the package.json version and use that instead. However it'd be great if CRXJS handles this internally, so you don't get surprised like that. Being able to import the manifest is something I expect to work. Because there were no big flashing errors, it took quite a bit of time to debug.
Reproduction
Import the main
mainfest.json
file in your app code.Logs
No response
System Info
Severity
annoyance