You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I'm using the next syntax for generating bundle filenames:
output: {
filename: 'bundle/[name].[hash].js',
},
new MiniCssExtractPlugin({
filename: 'bundle/[name].[hash].css',
}),
And the problem here is that if I use webpack in --watch mode then in every next build I'll get new app.552720a12c71ab7e7eb5.js in my /bundle directory without deleting previously built files.
I tried googling a fix for this small problem of mine and met this old question on StackOverflow where people suggested two options:
Deleting whole directory (which is not inapropriate in --watch mode) and rebuild from the scratch
Since [hash] syntax is Webpack's functionality, maybe it should watch /dist directory and replace old bundle builds with the new ones in --watch mode?
I'm sorry if this question was already asked and I missed it but there is really not so much information about it.
What is the expected behavior?
Replace old hash files with new ones in --watch mode
What is motivation or use case for adding/changing the behavior?
It'll speed up development process by not wasting much time on cleaning /dist dir and rebuild the whole project from the scratch.
How should this be implemented in your opinion?
I.e. we have webpack pattern bundle/[name].[hash].js which can be matched by regex. If a similar file was spotted in build process at dist dir, then Webpack should replace already existing file with newly generated one.
Are you willing to work on this yourself?
No
The text was updated successfully, but these errors were encountered:
In general old files should not be removed from the output directory since existing users could leave browser tabs open and request old files even after an update is deployed.
In development it's recommended to not use any hashing, since this will also slow down builds.
@sokra thanks. I have splitted my webpack config in two files for development and production builds and I'll build [hash]ed files in production builds only.
Feature request
Hello. I'm using the next syntax for generating bundle filenames:
And the problem here is that if I use webpack in
--watch
mode then in every next build I'll get newapp.552720a12c71ab7e7eb5.js
in my/bundle
directory without deleting previously built files.I tried googling a fix for this small problem of mine and met this old question on StackOverflow where people suggested two options:
--watch
mode) and rebuild from the scratchSince
[hash]
syntax is Webpack's functionality, maybe it should watch/dist
directory and replace old bundle builds with the new ones in--watch
mode?I'm sorry if this question was already asked and I missed it but there is really not so much information about it.
What is the expected behavior?
Replace old hash files with new ones in
--watch mode
What is motivation or use case for adding/changing the behavior?
It'll speed up development process by not wasting much time on cleaning
/dist
dir and rebuild the whole project from the scratch.How should this be implemented in your opinion?
I.e. we have webpack pattern
bundle/[name].[hash].js
which can be matched by regex. If a similar file was spotted in build process at dist dir, then Webpack should replace already existing file with newly generated one.Are you willing to work on this yourself?
No
The text was updated successfully, but these errors were encountered: