如何在 HtmlWebpackPlugin / webpack 2 中使用 chunksSortMode
How to use chunksSortMode in HtmlWebpackPlugin / webpack 2
我在 index.html 中插入的块的顺序有问题。
我正在使用 webpack2 和 HtmlWebpackPlugin。
我认为控制块顺序的是 chunksSortMode 选项。
HtmlWebpackPlugin 的 documentation 表示:
chunksSortMode: Allows to control how chunks should be sorted before
they are included to the html. Allowed values: 'none' | 'auto' |
'dependency' |'manual' | {function} - default: 'auto'
有什么区别:
- none
- 自动
- 依赖关系
- 手动
对于 'function' 选项, 让我见识到了
我可能不了解一些基本知识,因为我希望从一开始就在文档中找到这些信息。
我认为该文件可能对您有所帮助,它的评论很好。
chunksorter
简短摘要:
none: 执行恒等映射(无排序)。
自动: 按块 ID 排序
dependency: 根据 "parents" 属性对块之间的依赖关系进行排序。
手动: 按块手动排序:
- @param {Array} chunks 要排序的块
- @return {Array} 排序的块
我在 index.html 中插入的块的顺序有问题。
我正在使用 webpack2 和 HtmlWebpackPlugin。
我认为控制块顺序的是 chunksSortMode 选项。
HtmlWebpackPlugin 的 documentation 表示:
chunksSortMode: Allows to control how chunks should be sorted before they are included to the html. Allowed values: 'none' | 'auto' | 'dependency' |'manual' | {function} - default: 'auto'
有什么区别:
- none
- 自动
- 依赖关系
- 手动
对于 'function' 选项,
我可能不了解一些基本知识,因为我希望从一开始就在文档中找到这些信息。
我认为该文件可能对您有所帮助,它的评论很好。 chunksorter
简短摘要:
none: 执行恒等映射(无排序)。
自动: 按块 ID 排序
dependency: 根据 "parents" 属性对块之间的依赖关系进行排序。
手动: 按块手动排序:
- @param {Array} chunks 要排序的块
- @return {Array} 排序的块