Webpack plugin execution order problem

General webpack plugin

plugins: [
    new CopyWebpackPlugin([
    { from: "a.js", to: "dist/b.js" } // 1
    { from: "dist/b.js", to: "dist/c.js" } // 2
  ]),
   new CopyWebpackPlugin(....), // 3
    new CopyWebpackPlugin(....), //4 
]

I have two questions here?
1, if 2 depends on the execution result of 1 (comments), can you execute 1 first and then 2 (comments)? in practice, I found that they were carried out at the same time, not in order. If you want to do this in order, how do you do this?

2. Is the new in plugins executed in the order from top to bottom? For example, execute 3 (comments) and then 4 (comments), or at the same time? After reading the articles on the Internet, there is basically no such explanation

request an answer, thank you

Mar.01,2021

Webpack: Does the order of plugins matter?
you can see this answer in order. However, the plugin you use will bind the corresponding events yourself, so you generally don't have to pay attention to it.


  1. question 1 if you want to come in order, use chunksSortMode;
  2. question 2 load on demand.
Menu