Closed EdoanR closed 9 months ago
I just noticed this today too lol. Have you tried an inline source map? It could be that the browser can't load the map file since it's not in your manifest's web_accessible_resources
, and an inline map would solve that.
I have tested adding the map file to web_accessible_resourses
, and also tested inline source map. Both of them didn't work.
Checking the sources in the devtool it's showing that source map was detected.
Tested in Firefox and it's working properly.
The problem seems to be with Chrome, I have tested with others repo such as vitesse-webext
and with a simple project using webpack
, both of them have the same problem 😟.
This is happening only with content scripts. Background, options and popups are working fine.
Ok, I'm going to close this as an issue with Chrome then.
Update: I think chrome kinda fixed this issue, when seeing the content script in the sources tab now it will show a warning saying that the script is in the "ignore list" with a button to remove from it. When removing it and reloading the page the content script will show a warning saying that could not access the .map file, after adding the file to the web_accessible_resources
in the manifest the problem is fixed. Now it correctly use the map file.
Summary
I've been having problems getting the exact line that an error occurs in a content script since the build file looks different than the source file,
Even thought it has a
.map
file in the build.Reproduction
content-script.ts
file in thesrc
folder.// Throw a fake error. throw new Error('fake error');
pnpm dev
and go to https://vitejs.devEnvironment