Improve assets caching

This commit is contained in:
ErickSkrauch 2020-07-21 21:28:03 +03:00
parent 364b7f3c80
commit d25653dd7c
No known key found for this signature in database
GPG Key ID: 669339FCBB30EE0E

View File

@ -47,7 +47,7 @@ const webpackConfig = {
output: { output: {
path: outputPath, path: outputPath,
publicPath: '/', publicPath: '/',
filename: '[name].js?[hash]', filename: '[name].js?[chunkhash]',
}, },
resolve: { resolve: {
@ -179,14 +179,14 @@ const webpackConfig = {
test: /\.(png|gif|jpg|svg)$/, test: /\.(png|gif|jpg|svg)$/,
loader: 'file-loader', loader: 'file-loader',
query: { query: {
name: 'assets/[name].[ext]?[hash]', name: 'assets/[name].[ext]?[contenthash]',
}, },
}, },
{ {
test: /\.(woff|woff2|ttf)$/, test: /\.(woff|woff2|ttf)$/,
loader: 'file-loader', loader: 'file-loader',
query: { query: {
name: 'assets/fonts/[name].[ext]?[hash]', name: 'assets/fonts/[name].[ext]?[contenthash]',
}, },
}, },
{ {
@ -232,8 +232,7 @@ if (isProduction) {
webpackConfig.plugins.push( webpackConfig.plugins.push(
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
filename: '[name].css?[hash]', filename: '[name].css?[contenthash]',
chunkFilename: '[id].css?[hash]',
}), }),
); );
} }