Closed KidkArolis closed 5 years ago
I still have this issue and this cannot be the expected behavior...
I'm having this issue too and the suggested workarounds don't work. Can you reopen this?
Same issue here. The only fix for me was to add the plugin: https://github.com/yessky/webpack-mild-compile
i'm experiencing this bug, but with webpack 5. i've try using webpack-mild-compile but no hope. any idea how to resolve this issue?
i'm experiencing this bug, but with webpack 5. i've try using webpack-mild-compile but no hope. any idea how to resolve this issue? Could you provide reproduceable demo project? I'd try to fix it recently Try webpack-mild-compile@3.4.0
having this issue right now, the solutions don't seem to work (that is if I'm doing them correctly)
Having the same issue with webpack 5
Popping in here to say that I have a similar problem because I need to manipulate a file Webpack is watching before the watch compile occurs. The only solution that has worked for me is to combine the solution proposed by @fenomas with the information I found in https://github.com/webpack/webpack/issues/7997 by @jods4. By changing the mtime
of the file in the invalid
sync hook, the loop seems to be prevented.
Edit for context:
environment
hook to catch the initial compile and non-watch related compilesinvalid
hookmtime
in the invalid
hook immediately after
plugins: [
{
apply: (compiler) => {
compiler.hooks.environment.tap('environment', () => {
// ... Manipulate watched file
})
compiler.hooks.invalid.tap('invalid', (fileName, changeTime) => {
// ... Manipulate watched file again
// Update the mtime
var my_manipulated_file = path.resolve('path/to/my/manipulated/file')
var now = Date.now() / 1000
var then = now - 100
fs.utimes(my_manipulated_file, then, then, function (err) { if (err) throw err })
},
},
]
Hi. Lost a workday because of this. Please, consider fixing it. Thanks.
Its again happening in Angular 16 related. Kindly fix this permanently. thank you.
I've noticed this strange behaviour where watcher loops for 10 seconds due to this code:
https://github.com/webpack/watchpack/blob/7efdd93aff0c991a766af886ccc16324401a202f/lib/DirectoryWatcher.js#L202-L205
What I'm doing in my script is basically creating a file in a temporary directory
/temp/entry.js
, creating a webpack compiler and runcompiler.watch()
. Now for 10 seconds (which is the default value of FS_ACCURENCY) this is what's happening:/temp/entry.js
file, because it's < 10 seconds oldAny pointers on how to fix this would be helpful. For example, this could be fixed by modifying the above code to this, but I'd need to stare at this for longer to understand what this block of code is conceptually responsible for.