Didier Sampaolo
Didier Sampaolo

Reputation: 2823

Laravel Mix version() is forgetting one file

I'm using Laravel 5.4 and Mix to build my CSS/JS files.

Here is my full webpack.mix.js file :

mix
    .webpackConfig({output: {filename: '[name].js', chunkFilename: 'js/[name].[chunkhash].app.js', publicPath: '/'}})
    .js(['resources/assets/js/app.js'], 'public/js')
    .extract(['vue', 'jquery'])
    .sass('resources/assets/sass/app.scss', 'public/css')
    .version();

For some reason, the JS chunks and CSS files are versioned correctly, but my app.js isn't. Obvisouly, this causes various cache-related problems on my webapp.

I tried :

But no luck. Any hint would be greatly appreciated. Thank you !

Upvotes: 1

Views: 827

Answers (1)

Didier Sampaolo
Didier Sampaolo

Reputation: 2823

Turns out, after upgrading Laravel Mix to >1 (1.0.6), the first line isn't needed anymore. It was previsouly needed to ensure that webpack's code splitting feature would add hashes in chunks names (similar to what mix.version() does) - it was preventing Mix to rename my main app.js file.

By removing this line, everything works as expected.

Upvotes: 1

Related Questions