mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-17 19:13:34 +08:00
Since Angular 8, the CLI has transformed decorator metadata to a form that can be used by the Angular dependency injector without the TDZ limitations of Typescript's decorator metadata emit feature. As a result, a JIT application compiled with the CLI no longer requires the reflect metadata polyfill that was provided by `core-js`. This polyfill was also the last remaining usage of the `core-js` package within `@angular-devkit/build-angular` which allows the `core-js` package to also be removed. Refs: https://github.com/angular/angular-cli/pull/14473 & https://github.com/angular/angular/pull/37382 BREAKING CHANGE: Reflect metadata polyfill is no longer automatically provided in JIT mode Reflect metadata support is not required by Angular in JIT applications compiled by the CLI. Applications built in AOT mode did not and will continue to not provide the polyfill. For the majority of applications, the reflect metadata polyfill removal should have no effect. However, if an application uses JIT mode and also uses the previously polyfilled reflect metadata JavaScript APIs, the polyfill will need to be manually added to the application after updating. To replicate the previous behavior, the `core-js` package should be manually installed and the `import 'core-js/proposals/reflect-metadata';` statement should be added to the application's `polyfills.ts` file.
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.