Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webpack sometimes fails to detect changes saved with Intellij Idea

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?

like image 943
tobik Avatar asked Apr 21 '16 15:04

tobik


People also ask

Is IntelliJ good for JavaScript?

With IntelliJ IDEA, you can develop modern web, mobile, and desktop applications with JavaScript and Node. js. IntelliJ IDEA also supports React, Angular, Vue. js, and other frameworks and provides tight integration with various tools for web development.

How add JavaScript plugin to IntelliJ?

Press Ctrl+Alt+S to open the IDE settings and select Languages & Frameworks | JavaScript | Libraries. On the Libraries page that opens, click Download and in the Download Library dialog that opens, select the required library, and click Download and Install.

How do I restart IntelliJ?

From the main menu, select File | Manage IDE Settings | Restore Default Settings. Alternatively, press Shift twice and type Restore default settings . Click Restore and Restart. The IDE will be restarted with the default configuration.


1 Answers

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.

like image 189
Juho Vepsäläinen Avatar answered Oct 22 '22 06:10

Juho Vepsäläinen