1. const HtmlWebpackPlugin = require('html-webpack-plugin');
    2. module.exports = {
    3. entry: {
    4. index: './index.js',
    5. index2: './index2.js'
    6. },
    7. output: {
    8. filename: '[name].bundle.js'
    9. },
    10. plugins: [
    11. new HtmlWebpackPlugin({
    12. chunks: ['index'],
    13. hash: true,
    14. filename: 'index.html',
    15. template: './index.html',
    16. title: '你好世界!'
    17. }),
    18. new HtmlWebpackPlugin({
    19. chunks: ['index2'],
    20. hash: true,
    21. filename: 'index2.html',
    22. template: './index.html',
    23. title: '你好世界2!'
    24. }),
    25. ]
    26. }

    https://www.jianshu.com/p/6ce74871189a