Skip to content

Commit

Permalink
docs: 更新文档
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Jan 7, 2020
1 parent dd6644a commit 1a35faf
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions docs/config-detail.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,36 @@ mini: {
}
```

#### mini.commonChunks

配置打包时抽离的公共文件,如果是普通编译,则默认值为 `['runtime', 'vendors']`,如果是编译为微信小程序插件,则默认值为 `['plugin/runtime', 'plugin/vendors']`

`commonChunks` 的配置值主要依据 webpack 配置 [`optimization.runtimeChunk`](https://webpack.js.org/configuration/optimization/#optimizationruntimechunk)[`optimization.splitChunks`](https://webpack.js.org/plugins/split-chunks-plugin/),Taro 中默认的配置分别为


```javascript
optimization: {
runtimeChunk: {
name: 'runtime'
},
splitChunks: {
chunks: 'all',
maxInitialRequests: Infinity,
minSize: 0,
name: 'vendors',
cacheGroups: {
vendors: {
test (module) {
return /[\\/]node_modules[\\/]/.test(module.resource) && module.miniType !== PARSE_AST_TYPE.COMPONENT
}
}
}
}
}
```

如果有自行拆分公共文件的需求,请先通过 `webpackChain` 配置覆盖 `optimization.runtimeChunk``optimization.splitChunks` 配置,再通过 `commonChunks` 配置指定的公共入口文件。

### mini.cssLoaderOption

css-loader 的附加配置。配置项参考[官方文档](https://github.com/webpack-contrib/css-loader),例如:
Expand Down
2 changes: 1 addition & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const config = {
}
},
// 小程序端专用配置
weapp: {
mini: {
postcss: {
autoprefixer: {
enable: true
Expand Down

0 comments on commit 1a35faf

Please sign in to comment.