为什么我在构建 angular 12 应用程序时出错? [英] Why i get error on build angular 12 application?

查看:26
本文介绍了为什么我在构建 angular 12 应用程序时出错?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

角 12.

当我运行脚本时

ng build 

我收到很多错误,例如

Error: styles.62d50503994eb31b6b18.css from Css Minimizer
Error: [object Object] is not a PostCSS plugin

name.component.scss from Css Minimizer
Error: [object Object] is not a PostCSS plugin

推荐答案

样式优化有问题,v.12默认设置有变化https://angular.io/guide/workspace-config#optimization-configuration

It's a problem with styles optimization, the default settings have changed in v.12 https://angular.io/guide/workspace-config#optimization-configuration

尝试禁用优化选项中的 inlineCritical (angular.json):

Try to disable the inlineCritical in the optimization options (angular.json):

"optimization": {
   "scripts": true,
   "styles": {
      "minify": true,
      "inlineCritical": false
   },
   "fonts": true
},

这篇关于为什么我在构建 angular 12 应用程序时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆