United States Flag em Português
Cartoon avatar of my face.
tech lead @ Getrak
software development, technology, gaming and LGBTQ stuff
follow me on twitter

04/10/2017

Webpack is not rebuilding or reloading your project when the code changes in your Intellij IDE? Disable safe write.

Illustrative post image.

I am working on a project that uses NG6-starter as a base. Webpack usually rebuilds and reloads the project at every explicit save on the code file that I am working on. But since I reinstalled my OS (and all my dev tools), it doesn’t seemed to be working anymore.

After some hours of struggling, I found out that the cause of the problem is the Safe Write feature in JetBrains IDEs.

Basically, it’s a feature that writes your changes in a new file and saves it, then deletes your old file and renames the new file to the same as the deleted file. This process makes Webpack confused, preventing the rebuild trigger to be executed. The feature prevents corrupted files in some scenarios (but I’m pretty sure you’re safe disabling it — mainly if your project uses some sort of VCS).

How to disable Safe Write

  • In your IDE, go to File / Settings;
  • Type "Safe Write" in the search box;
  • Uncheck “Use ‘safe write’ (save changes to a temporary file first)”;
  • Click in apply, then ok.

Save any file and it should work.

Note: other IDEs and code editors seems to implement the same kind of feature. A quick Google Search should answer you how to disable it in your editor of choice.