Laravel mix 5.4 versioning


Following Laravel's documentation, he says that it is unnecessary to keep the css and js in development, which I think is correct. Then 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()) {

On the .env I have


APP_ENV = production

and to compile I do npm run production, but it does not work for me. This way you do not add the hash to the js and css.

Now if I add .version to the end of mix.js (...). version (); there if I walk, but both in development mode and in production mode.

asked by Juan Pablo B 24.07.2017 в 15:28

1 answer


I understand that in certain cases the mix that is in webpack.min.js is not exactly an instance of Mix, so you have to make the comparison with the configuration:

if (mix.config.inProduction) {
answered by 24.07.2017 / 15:54