Tampermonkey is the most popular userscript manager, with over 10 million users. It's available for Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.
GNU General Public License v3.0
4.3k
stars
424
forks
source link
[BUG] userscript sourcemap is mapping wrong variable #1621
Describe the bug userscript sourcemap is mapping wrong variable
To Reproduce install it, then open https://i.songe.li/, press
F12
and check consoleExpected behavior userscript sourcemap is mapping correct variable
Actual behavior userscript sourcemap is mapping wrong variable
Environment:
hello, I am developing dist.user.js
sourcemap
for vite-plugin-monkeybut I find Tampermonkey use wrapper function wrap userscript to run, It causes the code to offset
N
line backwardsand when use
@require
url, It also causes the code to offsetN
line backwardsso sourcemap will not map correct position
now I add
sourcemap offset
config for vite-plugin-monkey vite-plugin-monkey/src/node/types.ts#L308-L314but the developer must know the number of lines of code offset in advance
and I find that the number of offset that
Violentmonkey
causes is different from the number of offset that Tampermonkey causesThis breaks the unity, It's very inconvenient
so I hope Tampermonkey can automatically modify the inline sourcemap of userscript
it is very simple to modify sourcemap if you just set offset line
so are you willing to support
automatically modify sourcemap
?