Need advice about which tool to choose?Ask the StackShare community!
Angular CLI vs Webpack: What are the differences?
Key Differences between Angular CLI and Webpack
Angular CLI and Webpack are both popular tools used by web developers to streamline and enhance their development process. While they have overlapping functionalities, there are a few key differences between the two.
Structure and Convention: Angular CLI follows a strict project structure and enforces conventions for organizing files, while Webpack provides more flexibility and allows developers to customize the project structure according to their preferences.
Configuration Complexity: Angular CLI abstracts the configuration process and provides a simplified command-line interface, making it easier for developers to set up and configure their projects. On the other hand, Webpack requires manual configuration through a dedicated configuration file, which can be more complex and time-consuming.
Development Server: Angular CLI includes a built-in development server that allows developers to easily run and test their applications during the development process. Webpack, by itself, does not include a development server and requires additional setup to run the application locally.
Loaders and Plugins: Webpack provides a wide range of loaders and plugins that enable developers to customize the build and bundle process extensively. Angular CLI, on the other hand, abstracts this complexity and provides preconfigured loaders and plugins, simplifying the development experience.
Build Optimization: Angular CLI optimizes the build process by automatically splitting the code into smaller chunks and generating a production-ready bundle. Webpack, while capable of achieving similar optimization, requires manual configuration to achieve the same level of optimization.
Project Generation: Angular CLI provides a scaffolding feature that allows developers to quickly generate the basic files and folder structure for an Angular project. This feature is not available in Webpack and developers have to set up the project structure manually.
In summary, Angular CLI focuses on providing a straightforward and opinionated development experience with a structured project setup, while Webpack offers more flexibility and customization options at the cost of added complexity in configuration.
I could define the next points why we have to migrate:
- Decrease build time of our application. (It was the main cause).
- Also
jspm install
takes much more time thannpm install
. - Many config files for SystemJS and JSPM. For Webpack you can use just one main config file, and you can use some separate config files for specific builds using inheritance and merge them.
We mostly use rollup to publish package onto NPM. For most all other use cases, we use the Meteor build tool (probably 99% of the time) for publishing packages. If you're using Node on FHIR you probably won't need to know rollup, unless you are somehow working on helping us publish front end user interface components using FHIR. That being said, we have been migrating away from Atmosphere package manager towards NPM. As we continue to migrate away, we may publish other NPM packages using rollup.
Pros of Angular CLI
Pros of Webpack
- Most powerful bundler309
- Built-in dev server with livereload182
- Can handle all types of assets142
- Easy configuration87
- Laravel-mix22
- Overengineered, Underdeveloped4
- Makes it easy to bundle static assets2
- Webpack-Encore2
- Redundant1
- Better support in Browser Dev-Tools1
Sign up to add or upvote prosMake informed product decisions
Cons of Angular CLI
Cons of Webpack
- Hard to configure15
- No clear direction5
- Spaghetti-Code out of the box2
- SystemJS integration is quite lackluster2
- Loader architecture is quite a mess (unreliable/buggy)2
- Fire and Forget mentality of Core-Developers2