const path = require('path');
module.exports = {
//...
cache: {
type: 'filesystem', //'memory' | 'filesystem'
cacheDirectory: path.resolve(__dirname, '.temp_cache'),
},
};
<h2>Cache</h2>
<ul>
<li>缓存生成的 webpack 模块和 chunk,来改善构建速度。</li>
<li>默认缓存文件位置为 node_modules/.cache/</li>
<li>cache 类型设置为内存或者文件系统。'memory' | 'filesystem'。<strong style="color:red">filesystem开启更多配置项</strong></li>
</ul>
<h2>Devtool</h2>
<p>此选项控制是否生成,以及如何生成 source map。</p>
<h2>Targets</h2>
<p>webpack 能够为多种环境或 target 构建编译。</p>