Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Commit

Permalink
Enable [chunkhash] in the bundle name
Browse files Browse the repository at this point in the history
  • Loading branch information
iamakulov committed Jan 30, 2018
1 parent c376ab2 commit 19321a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion webpack.config.js
Expand Up @@ -27,7 +27,7 @@ module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'public', 'build'),
filename: 'bundle.js',
filename: isProduction ? 'bundle.[chunkhash].js' : 'bundle.js',
publicPath: '/build/',
},
module: {
Expand Down

1 comment on commit 19321a3

@iamakulov
Copy link
Contributor Author

@iamakulov iamakulov commented on 19321a3 Jan 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike previous commits, this one doesn’t affect the bundle size. Starting with this commit, we’ll start optimizing the app for caching instead of size.

This commit includes the file hash into the bundle name. This lets us enable caching – if the bundle gets changed, its name will also change, and the browser will re-download it. Corresponding article section

LitHub uses html-webpack-plugin, so the bundle file will be included into the HTML page automatically regardless of its name.

Generated files
Before:

bundle.js            · 154 kB
src/users/index.html · 412 bytes
src/index.html       · 686 bytes

After:

bundle.029b53b70b047fab072e.js · 154 kB
src/users/index.html           · 433 bytes
src/index.html                 · 707 bytes

Please sign in to comment.