mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-17 19:13:34 +08:00
With Webpack 5, passing the watch configuration option into the `webpack` factory function will cause the Webpack compiler to assume it should immediately start watching which requires a callback to be passed as well. Since the execution of the compiler is handled later in the process, a callback at the compiler creation stage is undesirable and could result in potentially breaking changes to accomplish.
Webpack Builder for Architect
This package allows you to run Webpack and Webpack Dev Server using Architect.
To use it on your Angular CLI app, follow these steps:
- run
npm install @angular-devkit/build-webpack
. - create a webpack configuration.
- add the following targets inside
angular.json
.
"projects": {
"app": {
// ...
"architect": {
// ...
"build-webpack": {
"builder": "@angular-devkit/build-webpack:webpack",
"options": {
"webpackConfig": "webpack.config.js"
}
},
"serve-webpack": {
"builder": "@angular-devkit/build-webpack:webpack-dev-server",
"options": {
"webpackConfig": "webpack.config.js"
}
}
}
- run
ng run app:build-webpack
to build, andng run app:serve-webpack
to serve.
All options, including watch
and stats
, are looked up inside the webpack configuration.