Auto-reloading (safe-write) issues of application development servers


I have discovered new module bundler for developing applications in JavaScript. It’s called Parcel.js and my initial impressions are positive. That’s what I tweeted about it:

Parcel is a web application bundler, differentiated by its developer experience. It offers blazing fast performance utilizing multicore processing, and requires zero configuration. Basically a fast Webpack alternative only without tons of configuration. Read more about its features here. I discovered it while looking at some library’s package.json checking which dependencies it uses. I use this technique often whatever the language library is written in because that’s how I find new and exciting libraries which makes me more productive.

The first problem I encountered while using it, has actually nothing to do with Parcel.js itself, but the way most editors save files which makes Parcel.js’ and many other development servers’ reloading capabilities limited to only first file save. This feature is called safe-write which doesn’t save changes in original file, but in a temporary file. Temporary file is than renamed and replaces original. This causes development servers with reload capabilities to lose track of file. Luckily we can turn this off (how-to for popular code editors). But before you do this, please educate yourself about the advantages of using safe-write. To sum up, it guards you against data loss if editor crashes. In my case this almost never happens so I don’t see the point of having safe-write enabled.