Skip to content

Commit 93b1db5

Browse files
committed
Shorten asset cache busting part to 8 chars
1 parent 584b6c7 commit 93b1db5

20 files changed

+34
-24
lines changed

config/webpack.config.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ module.exports = () => {
1919
},
2020
output: {
2121
path: path.resolve(process.cwd(), targetPath),
22-
filename: '[name].[contenthash].js',
23-
chunkFilename: '[name].[contenthash].js',
22+
filename: '[name].[contenthash:8].js',
23+
chunkFilename: '[name].[contenthash:8].js',
2424
},
2525
optimization: {
2626
runtimeChunk: 'single'
@@ -81,13 +81,23 @@ module.exports = () => {
8181
{
8282
test: /\.(gif|png|jpe?g|svg)$/i,
8383
use: [
84-
'file-loader',
84+
{
85+
loader: 'file-loader',
86+
options: {
87+
name: '[name].[hash:8].[ext]',
88+
}
89+
},
8590
],
8691
},
8792
{
8893
test: /\.(woff|woff2|eot|ttf|otf)$/,
8994
use: [
90-
'file-loader',
95+
{
96+
loader: 'file-loader',
97+
options: {
98+
name: '[name].[hash:8].[ext]',
99+
}
100+
},
91101
],
92102
},
93103
],
@@ -99,8 +109,8 @@ module.exports = () => {
99109
// https://webpack.js.org/guides/caching/#module-identifiers
100110
new webpack.HashedModuleIdsPlugin(),
101111
new MiniCssExtractPlugin({
102-
filename: '[name].[contenthash].css',
103-
chunkFilename: '[name].[contenthash].css',
112+
filename: '[name].[contenthash:8].css',
113+
chunkFilename: '[name].[contenthash:8].css',
104114
}),
105115
new PostCSSAssetsPlugin({
106116
plugins: [
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)