entry

    1. entry: {
    2. main:{
    3. // 入口
    4. import: ['./src/app.js','./src/app2.js'],
    5. // 公共依赖,单独打包出来
    6. dependOn: 'lodash',
    7. filename: "channel1/[name].js"
    8. },
    9. main2:{
    10. import: './src/app3.js',
    11. dependOn: 'lodash',
    12. filename: "channel2/[name].js"
    13. },
    14. lodash:{
    15. import: 'lodash',
    16. filename: "common/[name].js"
    17. }
    18. },

    plugi

    1. plugins: [
    2. new HtmlWebpackPlugin({
    3. title: "多页面应用01",
    4. template: "./index.html",
    5. // script标签引入的位置
    6. inject: 'body', // head,body
    7. // 输出文件名
    8. filename: "channel1/index.html",
    9. // 引入哪个入口,该实例载入哪些chunks
    10. chunks: ['main','lodash'],
    11. publicPath:'http://www.b.com'
    12. }),
    13. new HtmlWebpackPlugin({
    14. title: "多页面应用02",
    15. template: "./index2.html",
    16. inject: 'body',
    17. filename: "channel2/index2.html",
    18. chunks: ['main2','lodash'],
    19. publicPath:'http://www.a.com'
    20. }),
    21. ],