Reputation: 1331
When I run npn run dev on my Laravel project I get:
Is there any way to change the name of these numbered javascript assets to something unique such as a hash based on contents? They don't seem to have a cache busting hash in the query string when being requested and I have noticed issues from time to time with browsers caching these. Here is my webpack.mix.js file:
let mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.sass('resources/sass/web.scss', 'public/css/web.css')
.options({
processCssUrls: false,
}).version();
mix.extract(['vue', 'jquery']);
Upvotes: 6
Views: 2285
Reputation: 1331
This is what I eventually ended up doing and it works well:
mix.webpackConfig({
output: {
chunkFilename: "[name].[chunkhash:8].js",
filename: "[name].js",
}
});
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.sass('resources/sass/web.scss', 'public/css/web.css')
.options({
processCssUrls: false,
}).version();
mix.extract(['vue', 'jquery']);
Upvotes: 8