senyahnoj's avatar

Mix compiling differently on Windows and Linux

We are having trouble with laravel mix in a development team where some developers use Windows and others Linux.

Even though all are using the same versions of NPM and running npm run prod we are finding that many of the compiled assets have different SHA1 hashes. They look and behave the same, but it means that whenever one developer tries to commit to version control (git) nearly everything has changed rather than just the specific assets they have changed. This is making collaborative, simultaneous work on different parts of the code base very difficult.

We are specifically seeing the problem with jquery-ui (the ui-icons PNG files have extra bytes in them when 'mixed' on a windows client) and ckeditor.

It also seems to affect every 'mixed' CSS class.

Is this a problem anyone else has experienced? We would be grateful for any advice anyone could give.

We wondered if it had anything to do with line-endings although the differences in the PNG files may contradict this.

0 likes
1 reply
Cronix's avatar
Cronix
Best Answer
Level 67

It has to do with a lot of things (like different binaries required for windows vs linux), which in the end don't matter as you can't fix them. The best thing to do would be to have your windows users develop on a VM, like homestead (which is ubuntu). Then these things just "go away". The best thing you can do is have everyone on the team develop on the same OS that you are deploying to. We allow our devs to use whatever OS they want as their primary OS, but require that they develop on the same os that we deploy to. VM's allow for that to happen. It saves a lot of time and problems fixing stupid, tedious cross-os issues. Even things like windows being a case-insensitive OS and naming a class filename "someclass.php" but referencing it as "SomeClass" can blow up when putting on a linux server, where it would work fine on a windows os.

https://laravel.com/docs/5.6/homestead

Please or to participate in this conversation.