我正试图使用以下命令构建一个有角度的项目:
ng-build--configuration=production,我得到以下错误:
70% building 4/4 modules 0 activeAn unhandled exception occurred: No module factory available for dependency type: CssDependency
See "/private/var/folders/3q/rg85j7dj5dz5g37jk56731f40000gr/T/ng-p04YBZ/angular-errors.log" for further details.
而ng构建如预期的那样工作。
包.json
"dependencies": {
"@angular/animations": "~10.2.0",
"@angular/common": "~10.2.0",
"@angular/compiler": "~10.2.0",
"@angular/core": "~10.2.0",
"@angular/forms": "~10.2.0",
"@angular/platform-browser": "~10.2.0",
"@angular/platform-browser-dynamic": "~10.2.0",
"@angular/router": "~10.2.0",
"moment": "^2.29.1",
"moment-timezone": "^0.5.31",
"rxjs": "~6.5.4",
"single-spa": "^5.8.0",
"single-spa-angular": "^4.3.0",
"systemjs-webpack-interop": "~2.1.2",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-builders/custom-webpack": "^10",
"@angular-devkit/build-angular": "^0.1001.7",
"@angular/cli": "~10.1.7",
"@angular/compiler-cli": "~10.1.6",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.0.2",
"keycloak-js": "^3.4.3"
}
这可能有助于您解决问题
- 转到angular.json
- 在";配置";,查找";生产">
- 设置">extractPass";如果设置为false,则当前为true
希望这能有所帮助!