-
-
Notifications
You must be signed in to change notification settings - Fork 20
Description
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:
devServer: { static: path.resolve(__dirname, 'dist'), devMiddleware: { writeToDisk: true } }, plugins: [ new WebpackUserscript({ proxyScript: { baseUrl: `file://${path.resolve(__dirname, dist)}`, filename: '[basename].proxy.user.js', enable: !isProductionBuild } }) ]
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 to file://
instead of the webpack dev server.
Full configuration example here: https://github.com/testuser3158/ylis-suodatin/blob/master/webpack.config.js
Related:
- Avoid caching required scripts Tampermonkey/tampermonkey#723
- [Feature Rueqest] Force update for scripts under development Tampermonkey/tampermonkey#767
Lastly, thanks @momocow for this great plugin.