鍍金池/ 問(wèn)答/網(wǎng)絡(luò)安全  HTML/ webpack web-webpack-plugin插件的template屬性配

webpack web-webpack-plugin插件的template屬性配置成函數(shù)之后無(wú)法打包

最近在研究webpack多頁(yè)面,用到一個(gè)web-webpack-plugin插件,在測(cè)試多頁(yè)輸出時(shí),配置template這個(gè)屬性后編譯無(wú)法通過(guò),代碼如下
webpack.config.js

const { WebPlugin,AutoWebPlugin } = require('web-webpack-plugin')
const path = require('path')
module.exports = {
  entry: {
    app: './src/main.js'
  },
  output: {
    path: path.resolve(__dirname, 'dist/'),
    filename: '[name][hash].js'
  },
  plugins:[
    new AutoWebPlugin('./src/page/', {
      template: (pageName) => {  //配置此處后,webpack編譯就報(bào)錯(cuò)了,
       return path.resolve('./src/page/',pageName,'index.html');
      },
            ignorePages: ['ignore'],
            commonsChunk: {
                name: 'common',// name prop is require
                minChunks: 2,
            },
            outputPagemap: true,
        }),
  ]
}

看官方手冊(cè)配置完template屬性后,發(fā)現(xiàn)打包報(bào)錯(cuò) 內(nèi)容如下:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.module has an unknown property 'strictThisContextOnImports'. These properties are valid:
   object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, loaders?, noParse?, rules?, unknownContextCritical?, unknownCon
textRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp?, strictExpo
rtPresence? }

   Options affecting the normal modules (`NormalModuleFactory`).

幾經(jīng)嘗試后無(wú)果,求大佬指點(diǎn)

回答
編輯回答
挽歌

同是新手,沒(méi)有用過(guò)你說(shuō)的那個(gè)插件。但是多頁(yè)面的話,直接指定多個(gè)entry,用html-webpack-plugin提取多個(gè)html文件都是可以的

2017年12月20日 08:04