Categories
node-sass reactjs windows-subsystem-for-linux

Replace node-sass by a platform agnostic SASS compiler in a React project

We are a team of about 6 developers with heterogeneous setups (Windows 10, Ubuntu, macOS) and have started developing with React.

Scripting between Linux/macOS & Windows was a pain, so we decided to use Bash for Windows to run our builds. This works quite well once you’ve setup Bash correctly, and the integration with VS Code is great.
But there is a big catch: whenever you want to update your project outside of Bash (with CMD or PowerShell), you’re effectively switching your OS, and then you’ve got a nice error from node-sass saying that your environment has changed.

Since rebuilding node-sass simply never works, the only way we’ve found to get rid of this problem is deleting or renaming node_modules & running npm install again, but it’s very time/resource consuming.

We’ve seen that it looks like there is a native js alternative but we’d like to see if there’s anyone that has experienced the same & has found a suitable solution.

We really don’t have massive SASS files, so we don’t care so much about performance (which is the main point of doing it in C++ with libSass).

Note: We can’t always use Bash on Windows because we have some messy Maven integration in some Java / React apps that runs npm builds and this will always be in Windows.