In webpack's MiniCssExtractPlugin, where on earth is chunkFilename: "[id] .css"?

as shown in the figure, where is the id of [id] .css displayed in the 32 lines of chunkFilename: "[id] .css"
? Thank you

Apr.25,2022

mini-css-extract-plugin 's options is consistent with webpack's outputs . For details, please refer to the following example:

if you define the following entry:

entry: {
        A: './moduleA.js',
        B: './moduleB.js',
        C: './moduleC.js',
    }

the output definition looks like this:

output: {
    filename: '[name].js'
}

since name is app , a app.js

is output.

and the value of chunkFilename [id] .js tells webapck how to handle non- entry modules.

Modules in

entry can use either name or id , while those not entry can only use id . The default chunkFilname is [id] .css , which can not be set.

if you change filename:'[name] .js' of output to filename:'[id] .js , you can see output similar to the following:

Hash: f0856d7819896631db4b
Version: webpack 4.28.4
Time: 3391ms
Built at: 2019-01-15 18:03:59
          Asset       Size  Chunks             Chunk Names
           0.js  383 bytes       0  [emitted]  commons
       0.js.map  196 bytes       0  [emitted]  commons
           1.js  189 bytes       1  [emitted]  vendor
       1.js.map  857 bytes       1  [emitted]  vendor
           2.js   1.54 KiB       2  [emitted]  A
       2.js.map   5.31 KiB       2  [emitted]  A
           3.js   1.55 KiB       3  [emitted]  B
       3.js.map    5.3 KiB       3  [emitted]  B
           4.js   1.58 KiB       4  [emitted]  C
       4.js.map   5.31 KiB       4  [emitted]  C
    commons.css   60 bytes       0  [emitted]  commons
commons.css.map  150 bytes          [emitted]
     index.html  321 bytes          [emitted]

where A, B, C under Chunk Names corresponds to A, B, C of entry , while the number of the Asset column happens to be the value of the chunks column, so the value of the chunks column is id.

Menu