Skip to content

Commit de175d4

Browse files
authored
feat(cli-service): add inline loader support for html-webpack-plugin (#5997)
Close #2697
1 parent 89af6c5 commit de175d4

File tree

1 file changed

+6
-2
lines changed
  • packages/@vue/cli-service/lib/config

1 file changed

+6
-2
lines changed

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,19 @@ module.exports = (api, options) => {
163163
const entries = Array.isArray(entry) ? entry : [entry]
164164
webpackConfig.entry(name).merge(entries.map(e => api.resolve(e)))
165165

166+
// trim inline loader
167+
// * See https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md#2-setting-a-loader-directly-for-the-template
168+
const templateWithoutLoader = template.replace(/^.+!/, '').replace(/\?.+$/, '')
169+
166170
// resolve page index template
167-
const hasDedicatedTemplate = fs.existsSync(api.resolve(template))
171+
const hasDedicatedTemplate = fs.existsSync(api.resolve(templateWithoutLoader))
168172
const templatePath = hasDedicatedTemplate
169173
? template
170174
: fs.existsSync(htmlPath)
171175
? htmlPath
172176
: defaultHtmlPath
173177

174-
publicCopyIgnore.push(api.resolve(templatePath).replace(/\\/g, '/'))
178+
publicCopyIgnore.push(api.resolve(templateWithoutLoader).replace(/\\/g, '/'))
175179

176180
// inject html plugin for the page
177181
const pageHtmlOptions = Object.assign(

0 commit comments

Comments
 (0)