mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-25 16:57:51 +08:00
This is necessary as with the new compilation, leveraging pnpm-linked first party dependencies, there are cases **during migration** where multiple locations of the same package exist. e.g. - `@angular_devkit/architect/node_modules/@angular-devkit/core` (pnpm package output) - `@angular_devkit/core` (plain js sources) This is fine, and there is no risk of wrong types, and this should only occur during migration anyway, but it causes a few type issues as TypeScript is unable to emit proper types for inference. This is okay, as we'd likely even want to make use of `isolatedDeclarations` at some point, but we just add explicit types right now. (also making `Builder` type more type safe, checking assignability properly).
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.