This repo is a collection of simple demos of Webpack for long-term caching.
Before you learn those demos, you need to know about Webpack.
First, install webpack
and webpack-cli
globally.
$ npm i -g webpack webpack-cli
Then, clone the repo.
$ git clone https://github.com/Leecason/webpack-long-term-caching-demos.git
Install dependencies.
$ cd webpack-long-term-caching-demos
$ npm install
Now, play with the source files under the repo's demo* directories.
$ cd demo01
$ npm run build
- 简单的
hash
- 增加一个 vendors
- 使用
chunkhash
- 增加新模块
- 稳定
module id
- 增加 CSS 模块
contenthash
解决 CSS 模块修改后 JS 文件hash
变动问题- 增加异步模块
- 增加第二个入口文件
- 稳定
chunk id
MIT