Following the Laravel documentation, it says that it is unnecessary to keep versioned css and js in development which seems correct to me. So I did the following, I have in webpack.mix.js:
mix.js('resources/assets/js/app.js', 'public/js')
.js('resources/assets/js/mol.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
.sass('resources/assets/sass/mol.scss', 'public/css')
.sass('resources/assets/sass/login.scss', 'public/css');
if (mix.inProduction()) {
mix.version();
}
In the .env I have
APP_ENV=production
and to compile I do npm run production, but it doesn't work for me. This way you don't add the hash to the js and css.
Now if I add .version to the end of mix.js(...).version(); there if it works for me, but both in development mode and in production mode.
I have understood that in certain cases the mix that is in webpack.min.js is not exactly an instance of Mix, so the comparison must be made with the configuration: