R&D

SystemJS vs WebPack

Angular applications can use SystemJS to load application and library modules. However, there are alternatives that work just as well, specifically Webpack. SystemJS is often the popular choice, but it is important to understand the pros and cons of both SystemJS and Webpack so that we can make an informed choice.

So, Which of the two is better?

We conducted research and made some observations. It would appear that the difference between the two module loaders is something that people really like to argue about.

SystemJS

  1. SystemJS is known to be quirky with dependencies that it uses for its own polyfill
  2. Importing libraries/modules from npm is not as simple as it is using WebPack
  3. As you add dependencies and the code starts to grow, a fatal flaw of JSPM( systemjs) is revealed. It becomes extremely sluggish. A single refresh can take about 15-20 seconds as the browser will load 100s of different JavaScript files
  4. Gulp is still required for:
    • Minification
    • Envification (envify)
    • Generating unique hashname for bundle file
      .

WebPack

  1. Changes are now shown in milliseconds; Webpack’s dev server is designed for speed. Not only does it support incremental builds, it serves directly from memory
  2. You can easily import libraries from npm (e.g. Bootstrap or Foundation) without worrying about their exact path within node_modules
  3. No need of gulp. Webpack itself takes care of doing all the tasks that require Gulp in SystemJS
  4. It appears that Webpack was designed from the ground-up for large applications and it shows in the development process
    .

Both have their own pros and cons; it’s at the discretion of the developer to decide whether SystemJS or WebPack will suit the project at hand.