-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solution to userscript not refreshing on every page load #63
Comments
Thanks for providing the information! Maybe I should put this into the README for anyone who has been bothered in this caching and refreshing issues. |
I found after upgrading to devServer: {
hot: false,
devMiddleware: {
writeToDisk: true,
},
},
plugins: [
new WebpackUserscript({
proxyScript: {
enable: isDev,
baseUrl: url.pathToFileURL(path.resolve(__dirname, 'dist')).href,
// filename doesn't need to be set since it already defaults to '[basename].proxy.user.js'
},
}),
], |
For what it's worth, ViolentMonkey has a far better reload story. I just open the |
lol I spent about an hour trying to get the hot reload working with the proxy script via Tampermonkey. After that didn't work, I finally bit the bullet and installed the ViolentMonkey extension too. Ohhh boy it worked in about 2 minutes flat with the default user.js file! Thank you @mjpieters for sharing that gold nugget with the internet 💯 |
Hi,
Even with the use of proxy script and setting Tampermonkey's externals update interval to always, I noticed the old version of script would remain active for one or two page reloads. It seems like common problem so I'll leave my solution here, in case it's of use for someone.
In Tampermonkey's extension details page over at chrome://extensions/?id=dhdgffkkebhmkfjojejmpbldmpobfkfo, enable "Allow access to file URLs"
Use this webpack configuration:
The important bits are that we make webpack dev server write updated script to disk, so that Tampermonkey can access it with the
@require
header that now points tofile://
instead of the webpack dev server.Full configuration example here: https://github.com/testuser3158/ylis-suodatin/blob/master/webpack.config.js
Related:
Lastly, thanks @momocow for this great plugin.
The text was updated successfully, but these errors were encountered: