Webpack.js.org: How to set order of processing orders?

Created on 4 Mar 2021  路  3Comments  路  Source: webpack/webpack.js.org

Hi, in my project i use webpack with this config:

module.exports = () => [
    {
      name: 'client',
      target: 'web',
      // ...
    },

    {
      name: 'server',
      target: 'node',
      // ...
    },

    {
      name: 'other',
      // ...
    },
];

I need these entries to be collected in the order in which they are presented in the array

I thought the option parallelism: 1 would help, and set it to each entry, but its not working.

I run my last entry in node js immediately after emit and in this app i trying to read files from first entry (client) but this is not emitted

Most helpful comment

Seems you can set dependencies for your configurations, e.g.:

module.exports = () => [
    {
      name: 'client',
      target: 'web',
      // ...
    },

    {
      name: 'server',
      target: 'node',
      dependencies: ['client'], // should only run after `client` finish
      // ...
    },

    {
      name: 'other',
      dependencies: ['server'],
      // ...
    },
];

All 3 comments

For maintainers only:

  • [ ] webpack-4
  • [x] webpack-5
  • [ ] bug
  • [ ] critical-bug
  • [ ] enhancement
  • [ ] documentation
  • [ ] performance
  • [ ] dependencies
  • [x] question

Seems you can set dependencies for your configurations, e.g.:

module.exports = () => [
    {
      name: 'client',
      target: 'web',
      // ...
    },

    {
      name: 'server',
      target: 'node',
      dependencies: ['client'], // should only run after `client` finish
      // ...
    },

    {
      name: 'other',
      dependencies: ['server'],
      // ...
    },
];

@chenxsan Let's document it with example

Was this page helpful?
0 / 5 - 0 ratings