Is nobody else having/had problems with chunked files caching?
Mar 31, 2018
1
Level 9
Chunked files are still cached when using mix.version
Hi,
When I deploy to production I run a build locally using production flag.
My webpack config looks similar to the following
mix
.webpackConfig({
output: {
publicPath: mix.config.hmr ? '//localhost:8080' : '/',
chunkFilename: mix.inProduction() ? 'js/chunks/[name].js' : 'js/chunks/[name].[chunkhash].js'
},
})
.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
if (mix.inProduction()) {
mix.version();
...
}
...
My mix-manifest.json updates correctly, and shows a different querystring in the mapping
{
...
"/js/chunks/ComponentName.js": "/js/chunks/ComponentName.js?id=00f4f5f8a59fdc8dd9dc",
..
}
Im using the following to include versioned files in my index
<script src="{{ mix('js/manifest.js') }}"></script>
<script src="{{ mix('js/vendor.js') }}"></script>
<script src="{{ mix('js/app.js') }}"></script>
The issue is any changed components do not appear until I do a hard refresh or have my console open with Disable Cache enabled. I want to ensure that the public site is seeing any updates made to the web components.
Is there anything glaringly obvious that I am doing incorrectly here?
Thanks
--
laravel-mix: 2.1.11
laravel/framework: 5.5
npm 4.0.5
node v7.4.0
PHP 7.1.8
Please or to participate in this conversation.