Skip to content

Commit ef6c951

Browse files
author
chengyu.chengyulia
committed
feat: production mode useHtmlTemplate
1 parent 81c2177 commit ef6c951

File tree

1 file changed

+11
-9
lines changed
  • src/built-in-plugins/command-build/plugin

1 file changed

+11
-9
lines changed

src/built-in-plugins/command-build/plugin/build.ts

+11-9
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,17 @@ export const buildProject = async (opts: IOpts = {}) => {
3939
outFileName: '[name].js',
4040
publicPath: opts.publicPath, // If unset, use config value.
4141
pipeConfig: async config => {
42-
staticHtmlPaths.forEach(staticHtmlPath => {
43-
config.plugins.push(
44-
new HtmlWebpackPlugin({
45-
title: pri.sourceConfig.title || globalState.projectRootPath.split(path.sep).pop(),
46-
filename: staticHtmlPath,
47-
template: path.join(__dirname, '../../../../template-project.ejs'),
48-
}),
49-
);
50-
});
42+
if (pri.sourceConfig.useHtmlTemplate) {
43+
staticHtmlPaths.forEach(staticHtmlPath => {
44+
config.plugins.push(
45+
new HtmlWebpackPlugin({
46+
title: pri.sourceConfig.title || globalState.projectRootPath.split(path.sep).pop(),
47+
filename: staticHtmlPath,
48+
template: path.join(__dirname, '../../../../template-project.ejs'),
49+
}),
50+
);
51+
});
52+
}
5153
return config;
5254
},
5355
});

0 commit comments

Comments
 (0)