我无法ng serve
在开发模式下运行。
我已将 Angular v11 升级到 v12。从那以后,我一直在编译延迟,并且似乎没有启用开发模式。
我总是收到这个警告:
****************************************************************************************
This is a simple server for use in testing or debugging Angular applications locally.
It hasn't been reviewed for security issues.
DON'T USE IT FOR PRODUCTION!
****************************************************************************************
我的 Lazy Chunk 文件是这样的:
由于正在浏览器上设置编译文件,因此需要花费大量时间来调试任何内容。
我已经检查了我的 enviroment.ts 变量并设置为:
export const environment = {
production: false,
api: 'http://127.0.0.1:8000'
};
我的 Angular Extension for Chrome 警告我正在生产中运行,即使我不想:
We detected an application built with production configuration. Angular DevTools only supports development builds.
angular.json 上的 ng 服务部分
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "backoffice:build"
},
"configurations": {
"production": {
"browserTarget": "backoffice:build:production"
}
}
}
和 v11 上的完全一样,我已经检查过了
更新:迁移问题。像@BojanKojog
ng update @angular/cli --migrate-only --from=11.2.0
一样运行,回答如下。