Skip to content

Commit

Permalink
fix(mpa): conflicts with webpack plugin (#10005)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Dec 8, 2022
1 parent c70a8c9 commit f55514a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions examples/mpa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@example/mpa",
"private": true,
"scripts": {
"build": "umi build",
"dev": "umi dev",
"start": "npm run dev"
},
Expand Down
6 changes: 4 additions & 2 deletions packages/preset-umi/src/features/webpack/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ export default (api: IApi) => {
}

api.modifyWebpackConfig((config) => {
// 处理 代码拆分时, 拆分的 非 入口文件, 自动注入到 html 文件中
config.plugins?.push(new HtmlWebpackPlugin());
if (!api.config.mpa) {
// 处理 代码拆分时, 拆分的 非 入口文件, 自动注入到 html 文件中
config.plugins?.push(new HtmlWebpackPlugin());
}
return config;
});

Expand Down

0 comments on commit f55514a

Please sign in to comment.