webpack: Use filenames based on hashes.

This should avoid us creating duplicate webpack bundles every time we
do a deployment, even if none of the files in the bundles themselves
have changed at all.
This commit is contained in:
Tim Abbott
2018-06-01 17:19:12 -07:00
parent 714ad67db1
commit 7813376934

View File

@@ -119,7 +119,7 @@ export default (env?: string) : webpack.Configuration => {
}, },
output: { output: {
path: resolve(__dirname, '../static/webpack-bundles'), path: resolve(__dirname, '../static/webpack-bundles'),
filename: production ? '[name]-[hash].js' : '[name].js', filename: production ? '[name]-[chunkhash].js' : '[name].js',
}, },
resolve: { resolve: {
extensions: [".tsx", ".ts", ".js", ".json", ".scss", ".css"], extensions: [".tsx", ".ts", ".js", ".json", ".scss", ".css"],
@@ -145,7 +145,7 @@ export default (env?: string) : webpack.Configuration => {
} }
return '[name].[contenthash].css'; return '[name].[contenthash].css';
}, },
chunkFilename: "[id].css" chunkFilename: "[chunkhash].css"
}) })
]; ];
} else { } else {
@@ -162,7 +162,7 @@ export default (env?: string) : webpack.Configuration => {
// Extract CSS from files // Extract CSS from files
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
filename: "[name].css", filename: "[name].css",
chunkFilename: "[id].css" chunkFilename: "[chunkhash].css"
}), }),
]; ];