1. const config = {
    2. entry:{
    3. index:path.join(srcPath,'index.js'),
    4. other:path.join(srcPath,'other.js')
    5. },
    6. plugins:[
    7. new HtmlWebpackPlugin({
    8. template:path.join(srcPath,'index.html'),
    9. filename:'index.html',
    10. // chunks 表示该页面要引用哪些chunk 即上面的 index 和 other
    11. chunks:['index']
    12. }),
    13. new HtmlWebpackPlugin({
    14. template:path.join(srcPath,'other.html'),
    15. filename:'other.html',
    16. chunks:['other']
    17. })
    18. ]
    19. }

    entry:配置入口文件
    plugins:[ new HtmlWebpackPlugin()] 生成html文件,去指定入口配置的文件