Order of execution for multiple entries


I have a webpack config with multiple entries that generates some js and css files.
The first entry generates a file that is required by the second entry, since these two processes run in parallel I have no control over the order in which they are executed.

The second entry ends up running first and exits with an error as it is not able to find the module which the first entry builds (which is required by the second entry).

Is there a way I can run these multiple processes sequentially ? I am using webpack v1.14.0

Any help would be appreciated, thanks!

Author: Fantashit

1 thought on “Order of execution for multiple entries

  1. In case anyone else finds this looking for ways to run multiple configs in sequence, I found a way to get this working in a single build by waiting for the products of one build before starting the other:

    const WebpackBeforeBuildPlugin = require('before-build-webpack')
    const fs = require('fs')
    class WaitPlugin extends WebpackBeforeBuildPlugin {
      constructor(file, interval = 100, timeout = 10000) {
        super(function(stats, callback) {
          let start = Date.now()
          function poll() {
            if (fs.existsSync(file)) {
            } else if (Date.now() - start > timeout) {
              throw Error("Maybe it just wasn't meant to be.")
            } else {
              setTimeout(poll, interval)
    const serverConfig = {
      entry: './src/server/index.js',
      plugins: [
        new WaitPlugin('file/the/build/depends/on.js')

    Can read a full write-up about the solution here – https://www.viget.com/articles/run-multiple-webpack-configs-sequentially/

Comments are closed.