首页 > 其他分享 >Angular Generating browser application bundles (phase: setup)...An unhandled exception occurred

Angular Generating browser application bundles (phase: setup)...An unhandled exception occurred

时间:2023-04-01 12:01:19浏览次数:39  
标签:... Generating setup bundles webpack devkit angular

PS F:\WorkGitHub\angulard3tree> ng serve
⠋ Generating browser application bundles (phase: setup)...An unhandled exception occurred: webpack_1.AngularWebpackPlugin is not a constructor
See "C:\Users\ghosii\AppData\Local\Temp\ng-daZXzA\angular-errors.log" for further details.
⠦ Generating browser application bundles (phase: setup)...

chatGPT也没有解决到

如果你的Angular版本是12及以上,但是在编译过程中遇到了 webpack_1.AngularWebpackPlugin is not a constructor 错误,可以尝试以下解决方法:

  1. 升级 @angular-devkit/build-angular 到最新版本。可以运行以下命令更新:
    sqlCopy code

ng update @angular-devkit/build-angular


  1. 确认 tsconfig.json 中的 angularCompilerOptions 选项被正确配置。可以参考以下配置:
    jsonCopy code

"angularCompilerOptions": { "enableIvy": true, "tsConfig": "./tsconfig.app.json" }


  1. 检查是否已经安装了 @ngtools/webpack。如果没有安装可以运行以下命令安装:
    sqlCopy code

npm install @ngtools/webpack --save-dev

  1.   如果问题仍然存在,请尝试卸载并重新安装@angular-devkit/build-angular和@angular/cli,然后执行npm install或yarn install更新依赖项。  



标签:...,Generating,setup,bundles,webpack,devkit,angular
From: https://blog.51cto.com/u_15709472/6163468

相关文章