webpack: how to ordering dependencies between entries

in my webpack config file I have two multy entries:

module.exports = {
      entry:{
             lib:["./scripts/file1.js","./scripts/fil2.ts"],
             app:["./scripts/login.js","./public/HSplitLayout.js"]
      },
      output: {
        path: 'builds',
        filename: '[name].js',
        publicPath: 'builds/',
        libraryTarget: "var"
    }
}

I want to ensure that the lib.js file is completely loaded before app.js is loaded.

Thank you for your help

Author: Fantashit

1 thought on “webpack: how to ordering dependencies between entries

  1. Just put <script src="lib.js"/> before <script src="app.js" /> in your page…
    Browser loads scripts in order synchronously.
    It is more complicated when you bundle multiple entries in one file, I noticed it sometimes does mangle the order. The best solution in this case is to just have your main application as an entry, and from there just require or import your library.

Comments are closed.