webpack多入口配置

const path=require("path");
const HtmlWebpackPlugin=require("html-webpack-plugin")

module.exports={
    entry:{
        app:'./src/app.js',
        main:'./src/main.js'
    },
    output:{
        path:path.resolve(__dirname,"dist"),
        filename:"[name].js"//webpack中的命名方式,【name】以文件名自己命名
    },
    plugins:[
        new HtmlWebpackPlugin({
            template:path.resolve(__dirname,"public/index.html")
        })
    ],
    // plugins: [
    //     new webpack.LoaderOptionsPlugin({
    //       // test: /\.xxx$/, // may apply this only for some modules
    //       options: {
    //         Plugins: …
    //       }
    //     })
    //   ],
    mode:'production'
}

 

posted @ 2022-11-24 11:05  小白字太白  阅读(120)  评论(0)    收藏  举报