Closed Juraj-Masiar closed 4 years ago
Reasonable request. Thanks for the feedback.
@Juraj-Masiar It actually can be achieved in the current version with using HeaderProvider. HeaderProvider will be called after each compilation.
In the webpack.config.js
, construct the plugin instance with the following options,
new WebpackUserscript({
headers ({ version }) {
const buildTime = Date.now()
return {
version: `${version}-build.${buildTime}`
}
}
})
Instead of changing the current buildNo
, I think a new variable buildTime
can be provided as well in the future version, then you can use it in the template string instead of using HeaderProvider function.
Nice! It works perfect!
Good thinking :)
Feel free to close this, but I do like the idea with the buildTime
variable, I'm sure other would appreciate it as well.
Thanks again for fast fix!
Hello,
First of all, thank you for making this useful plugin!
I've just started to use it and I noticed that if I stop the server and start it again, it will generate
v1.0.0-build.2
again which is usually older than the version I had before and I have to reinstall the script manually (by clicking "Downgrade").Is there a way to remember build number to make development easier? Or maybe just use current time:
Date.now()
as build version, that way it will always generate bigger number.Something like this in your index.js: