unsafeWindow.stop(); isn't executing at document-start while in dev mode
Thorvarium opened this issue · 2 comments
Hi, thanks for this awesome work!
I am having one little issue that I haven't been able to figure out:
When I have a regular user script, I can use window.stop()
and // @run-at document-start
and the page will stop loading even before rendering.
But, if I put inside main.tsx:
import { unsafeWindow} from "$"; unsafeWindow.stop();
the page only stops after loading and after a bunch of native scripts from the website executed.
Is there a way to create a small script file that will make that content be bundled together in the userscript instantly? Without having to wait for the dev server to load by entryScript.src? That is the only thing that I would like to have executed instantly before loading the dev server.
I am using the react-ts template.
monkey({
entry: 'src/main.tsx',
format: {
generate(uOptions) {
if (uOptions.mode === 'serve') {
return (
`
// your code
` +
'\n' +
uOptions.userscript
);
}
return uOptions.userscript;
},
},
@lisonge awesome! I've inverted the concatenation to show under the headers