2016-09-15 69 views

回答

0
  • 第一步:

生成HTML文件(S):

module.exports = { 
    entry: { 
    'page1': './apps/page1/scripts/main.js', 
    'page2': './apps/page2/src/main.js' 
    }, 
    output: { 
    path: __dirname, 
    filename: "apps/[name]/build/bundle.js" 
    }, 
    plugins: [ 
    new HtmlWebpackPlugin({ 
     inject: true, 
     chunks: ['page1'], 
     filename: 'apps/page1/build/index.html' 
    }), 
    new HtmlWebpackPlugin({ 
     inject: true, 
     chunks: ['page2'], 
     filename: 'apps/page2/build/index.html' 
    }) 
    ] 
}; 
  • 第二步:生成的HTML文件(S)添加到您的玉文件

    包括../../public/index.html