Commit 6fddd9ba authored by 尚斌杰's avatar 尚斌杰

修复html-webpack-plugin bug

parent eb5fec9e
...@@ -219,11 +219,11 @@ async function build (args, api, options) { ...@@ -219,11 +219,11 @@ async function build (args, api, options) {
webpackConfig.output.publicPath = '' webpackConfig.output.publicPath = ''
webpackConfig.output.path = targetDir webpackConfig.output.path = targetDir
for(let item of webpackConfig.plugins) { for(let item of webpackConfig.plugins) {
if (item.options && item.options.template) { if (item.userOptions && item.userOptions.template) {
item.options.template = pagePath + '/index.html' item.userOptions.template = pagePath + '/index.html'
item.options.header = headerTpl item.userOptions.header = headerTpl
item.options.footer = footerTpl item.userOptions.footer = footerTpl
item.options.common = (commonPath && process.env.NODE_ENV === 'production')?`<link href=${commonPath} rel=preload as=script><script src="${commonPath}"></script>`:'' item.userOptions.common = (commonPath && process.env.NODE_ENV === 'production')?`<link href=${commonPath} rel=preload as=script><script src="${commonPath}"></script>`:''
} }
} }
for (let item of webpackConfig.module.rules) { for (let item of webpackConfig.module.rules) {
......
...@@ -113,10 +113,10 @@ module.exports = (api, options) => { ...@@ -113,10 +113,10 @@ module.exports = (api, options) => {
app: pagePath + '/index' app: pagePath + '/index'
} }
for(let item of webpackConfig.plugins) { for(let item of webpackConfig.plugins) {
if (item.options && item.options.template) { if (item.userOptions && item.userOptions.template) {
item.options.template = pagePath + '/index.html' item.userOptions.template = pagePath + '/index.html'
item.options.header = headerTpl item.userOptions.header = headerTpl
item.options.footer = footerTpl item.userOptions.footer = footerTpl
} }
} }
} else { } else {
......
{ {
"name": "vue-cli-plugin-ts-multi-pages", "name": "vue-cli-plugin-ts-multi-pages",
"version": "2.0.0-alpha.0", "version": "2.0.0-alpha.1",
"description": "vue-cli3多页开发插件TS版", "description": "vue-cli3多页开发插件TS版",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment