Why is [name] always main in MiniCssExtractPlugin for webpack?

后端 未结 1 1493
抹茶落季
抹茶落季 2021-01-27 01:09

In webpack when configuring the MiniCssExtractPlugin, I don\'t understand why [name] is always \"main\"?

 plugins: [
   new MiniCssExtractPlugin({
      filenam         


        
相关标签:
1条回答
  • 2021-01-27 01:41

    The [name] is the name of the entry point.

    If the entry point is a String or Array webpack will use a a default entry name main, based on https://github.com/webpack/webpack/blob/6f413ae2e63897aef5e1956cb1c351ab33f6dbfe/lib/EntryOptionPlugin.js#L76.

    You can provide your entry point as an object,

    module.exports = {
      entry: { myName: './src/app.js'},
      output: {
        path: utils.resolve('/dist'),
      },
      ...
    }
    

    which will change entry name to myName.

    0 讨论(0)
提交回复
热议问题