Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/@vue/cli-service/lib/config/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,20 @@ module.exports = (api, options) => {
const entries = Array.isArray(entry) ? entry : [entry]
webpackConfig.entry(name).merge(entries.map(e => api.resolve(e)))

// test whether use 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 inlineLoaderReg = /[-!]?!.+!/
const isWithInlineLoader = /^[-!]?!/.test(template)

// resolve page index template
const hasDedicatedTemplate = fs.existsSync(api.resolve(template))
const hasDedicatedTemplate = fs.existsSync(api.resolve(isWithInlineLoader ? template.replace(inlineLoaderReg, '') : template))
const templatePath = hasDedicatedTemplate
? template
: fs.existsSync(htmlPath)
? htmlPath
: defaultHtmlPath

publicCopyIgnore.push(api.resolve(templatePath).replace(/\\/g, '/'))
publicCopyIgnore.push(api.resolve(templatePath).replace(/\\/g, '/').replace(inlineLoaderReg, ''))

// inject html plugin for the page
const pageHtmlOptions = Object.assign(
Expand Down