angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Webpack Benefits

Open dolanmiu opened this issue 10 years ago • 9 comments

Webpack update

We changed the build system between beta.10 and beta.14, from SystemJS to Webpack. And with it comes a lot of benefits. To take advantage of these, your app built with the old beta will need to migrate.

You can update your beta.10 projects to beta.14 by following these instructions.

Could someone elaborate on the benefits from switching from SystemJS to Webpack? The only benefit I can see so far is automatic detection and transpiling of .css and .scss files, which is cool.

P.S. What about JSPM?

dolanmiu avatar Sep 28 '16 12:09 dolanmiu

There are a lot of behind the scenes features that webpack brings to the table out of the box, that SystemJS + SystemBundler did not.

It's really important to keep in mind the following:

webpack: module bundler (static build tool) SystemJS: module loader (dynamic module loading in the run time) SystemBundler: (the static build tool companion to SystemJS)

So the two aren't really the same thing, and serve different purposes (maybe in the future we [the webpack core team] will chose to have a stronger interop story between the two])

TheLarkInn avatar Sep 28 '16 12:09 TheLarkInn

The highest benefit I can think of as of personal opinion is that you don´t have to keep track of what packages to add or remove in SystemJS, this is all done automatic because webpack uses the package.json information.

You also have a lot of control over the way your application will be built, but most of that customization is simplified with angular-cli.

manuelcua avatar Sep 28 '16 13:09 manuelcua

because webpack uses the package.json information

No, it does not use package.json information. Webpack analyzes your JS code and searches for imports, then it bundles everything. Webpack 2 is also doing a tree shake, meaning it searches for classes and functions which are not used in your application in any way and removes them from bundle.

Auxx avatar Sep 28 '16 19:09 Auxx

@Auxx : Thank you for clarify that, when I changed to Webpack in my App I was sure I read somewhere that it was like that, but either way Webpack takes the burden off from managing those packages on my App.

manuelcua avatar Sep 28 '16 20:09 manuelcua

I see, that makes sense

I have read somewhere that angular-cli decided to change to Webpack because SystemJS is still very new in its infancy and therefore not reliable. Is this true?

Source:

https://www.reddit.com/r/Angular2/comments/4lbdys/webpack_vs_systemjs_pros_cons/

dolanmiu avatar Sep 28 '16 20:09 dolanmiu

As someone who is working on an old pre-webpack project, one of the main advantages of webpack is that it makes installing 3rd party libraries a whole lot easier.

bonnici avatar Sep 28 '16 22:09 bonnici

Seems the Angular team might end up with using Webpack 2 instead of broccoli as a lot of people in the community are in favour of it. They have already introduced a new module called compiler-cli for offline compilation. Think it does some tree shaking too but it isn't quite stable as of RC3.

Perhaps the main reason is that the community wants Webpack, so Angular2 delivers Webpack?

Source: https://www.reddit.com/r/Angular2/comments/4lbdys/webpack_vs_systemjs_pros_cons/

dolanmiu avatar Sep 29 '16 09:09 dolanmiu

Most of the discussion around this topic is found on https://github.com/angular/angular-cli/issues/909.

filipesilva avatar Oct 05 '16 15:10 filipesilva

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.