Skip to content

Commit 81c8d59

Browse files
LuckyFBBkiwiwongjiming
authored
Add htmlChunks configuration item (#159) (#160)
* Add htmlChunks configuration item (#159) * feat(ko): add htmlChunks configuration item * docs: add htmlChunks to configuration * docs(changeset): add htmlChunks to configure the chunks of HtmlWebpackPlugin --------- Co-authored-by: jiming <[email protected]> * RELEASING: Releasing 1 package(s) Releases: [email protected] [skip ci] --------- Co-authored-by: Shawn <[email protected]> Co-authored-by: jiming <[email protected]>
1 parent 9ff6509 commit 81c8d59

File tree

6 files changed

+18
-4
lines changed

6 files changed

+18
-4
lines changed

packages/ko/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# ko
22

3+
## 6.5.10
4+
5+
### Patch Changes
6+
7+
- 63e89263e: add htmlChunks to configure the chunks of HtmlWebpackPlugin
8+
39
## 6.5.9
410

511
### Patch Changes

packages/ko/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ko",
3-
"version": "6.5.9",
3+
"version": "6.5.10",
44
"description": "build & lint library",
55
"keywords": [
66
"ko",

packages/ko/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export type IOptions = {
1515
externals?: Record<string, string>;
1616
plugins?: HookOptions[];
1717
htmlTemplate?: string;
18+
htmlChunks?: 'all' | string[];
1819
// style configs
1920
analyzer?: boolean;
2021
extraPostCSSPlugins?: Plugin[];

packages/ko/src/webpack/plugins.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,18 @@ function getPlugins(opts: IWebpackOptions) {
1616
const {
1717
isProd,
1818
htmlTemplate,
19+
htmlChunks,
1920
copy,
2021
analyzer,
2122
autoPolyfills,
2223
serve: { host, port, compilationSuccessInfo },
2324
} = opts;
25+
const htmlOptions: HtmlWebpackPlugin.Options = {
26+
template: htmlTemplate,
27+
};
28+
if (htmlChunks) {
29+
htmlOptions.chunks = htmlChunks;
30+
}
2431
return [
2532
new IgnorePlugin({
2633
resourceRegExp: /^\.\/locale$/,
@@ -71,9 +78,7 @@ function getPlugins(opts: IWebpackOptions) {
7178
chunkFilename: 'css/[id].[contenthash].css',
7279
}),
7380
new CaseSensitivePathsPlugin(),
74-
new HtmlWebpackPlugin({
75-
template: htmlTemplate,
76-
}),
81+
new HtmlWebpackPlugin(htmlOptions),
7782
copy &&
7883
new CopyWebpackPlugin({
7984
patterns: copy,

website/docs/configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export type IOptions = {
1818
externals?: Record<string, string>; //excluding dependencies from the output bundles
1919
plugins?: any[]; // ko internal plugins, you can define your own plugin of ko.
2020
htmlTemplate?: string; //output html file template
21+
htmlChunks?: 'all' | string[]; // add only some chunks to html
2122
// style configs
2223
analyzer?: boolean; // show output files with an interactive zoomable treemap
2324
extraPostCSSPlugins?: Plugin[]; // extra post css plugins

website/i18n/zh-CN/docusaurus-plugin-content-docs/current/configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export type IOptions = {
1818
externals?: Record<string, string>; // 从输出的Bundle中需要排除的依赖
1919
plugins?: any[]; // ko 内部插件,您可以定义自己的 ko 插件。
2020
htmlTemplate?: string; // 输出 HTML 文件模板
21+
htmlChunks?: 'all' | string[]; // 添加到 HTML 中的 chunk
2122
// 样式配置
2223
analyzer?: boolean; // 显示带有可缩放的交互式树状图的输出文件
2324
extraPostCSSPlugins?: Plugin[]; // 额外的 postcss 插件

0 commit comments

Comments
 (0)