Skip to content

Commit 4cabf5e

Browse files
committed
feat: allow user to customize html-webpack-plugin option in multi-page mode
closes #2544
1 parent 8a54ef6 commit 4cabf5e

File tree

1 file changed

+13
-7
lines changed
  • packages/@vue/cli-service/lib/config

1 file changed

+13
-7
lines changed

packages/@vue/cli-service/lib/config/app.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ module.exports = (api, options) => {
182182
entry,
183183
template = `public/${name}.html`,
184184
filename = `${name}.html`,
185-
chunks
185+
chunks,
186+
...customHtmlOptions
186187
} = normalizePageConfig(multiPageConfig[name])
187188
// inject entry
188189
webpackConfig.entry(name).add(api.resolve(entry))
@@ -199,12 +200,17 @@ module.exports = (api, options) => {
199200
: defaultHtmlPath
200201

201202
// inject html plugin for the page
202-
const pageHtmlOptions = Object.assign({}, htmlOptions, {
203-
chunks: chunks || ['chunk-vendors', 'chunk-common', name],
204-
template: templatePath,
205-
filename: ensureRelative(outputDir, filename),
206-
title
207-
})
203+
const pageHtmlOptions = Object.assign(
204+
{},
205+
htmlOptions,
206+
{
207+
chunks: chunks || ['chunk-vendors', 'chunk-common', name],
208+
template: templatePath,
209+
filename: ensureRelative(outputDir, filename),
210+
title
211+
},
212+
customHtmlOptions
213+
)
208214

209215
webpackConfig
210216
.plugin(`html-${name}`)

0 commit comments

Comments
 (0)