I'm developing a JavaScript/React application in Intellij Idea and I'm using webpack-dev-server
to incrementally build my files. That means that the dev server is watching the files and if a file gets changes, webpack
rebuilds it. Pretty standard scenario.
Unfortunately, webpack
sometimes decides to ignore certain files. I can change them all I want but webpack
does nothing. I have not been able to determine any pattern on which files get ignored. It's arbitrary. Sometimes I just create a new file and webpack
ignores it.
What is interesting though is that it only happens when I perform the save using Intellij Idea. If I open the file in another editor (for example vim) and save it, the file gets correctly rebuilt. Actually, simple touch file.js
is enough to trigger rebuilding.
I guess there is something wrong in how Intellij Idea saves files. Any ideas?
This is due to an IDE feature known as "safe write". When enabled, the IDE will write the changes to a temporary file over the real one. This means webpack's file watching mechanism cannot pick up the changes. Disable this feature to fix the problem. Reference.