diff --git a/packages/@vue/cli-service/lib/config/app.js b/packages/@vue/cli-service/lib/config/app.js index 978d4faacb..2fcbfa8a21 100644 --- a/packages/@vue/cli-service/lib/config/app.js +++ b/packages/@vue/cli-service/lib/config/app.js @@ -163,15 +163,19 @@ module.exports = (api, options) => { const entries = Array.isArray(entry) ? entry : [entry] webpackConfig.entry(name).merge(entries.map(e => api.resolve(e))) + // trim inline loader + // * See https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md#2-setting-a-loader-directly-for-the-template + const templateWithoutLoader = template.replace(/^.+!/, '').replace(/\?.+$/, '') + // resolve page index template - const hasDedicatedTemplate = fs.existsSync(api.resolve(template)) + const hasDedicatedTemplate = fs.existsSync(api.resolve(templateWithoutLoader)) const templatePath = hasDedicatedTemplate ? template : fs.existsSync(htmlPath) ? htmlPath : defaultHtmlPath - publicCopyIgnore.push(api.resolve(templatePath).replace(/\\/g, '/')) + publicCopyIgnore.push(api.resolve(templateWithoutLoader).replace(/\\/g, '/')) // inject html plugin for the page const pageHtmlOptions = Object.assign(