typescript - 安装 Angular Universal 时缺少 main.server.ts 和 app.server.module.ts
我正在尝试按照文档中所述使用以下命令安装 Angular Universal:
ng add @nguniversal/express-engine
它创建了文件 server.ts,但没有创建 main.server.ts 和 app.server.module.ts。我不太确定问题出在哪,但我的 package.json、Angular 版本和 tsconfig.server 如下:
package.json(简化版)
"private": true,
"dependencies": {
"@angular/animations": "~13.2.1",
"@angular/cdk": "^13.2.1",
"@angular/common": "~13.2.1",
"@angular/compiler": "~13.2.1",
"@angular/core": "~13.2.1",
"@angular/forms": "~13.2.1",
"@angular/material": "^13.2.1",
"@angular/platform-browser": "~13.2.1",
"@angular/platform-browser-dynamic": "~13.2.1",
"@angular/platform-server": "~13.2.1",
"@angular/router": "~13.2.1",
"@fortawesome/angular-fontawesome": "^0.10.1",
"@fortawesome/fontawesome-svg-core": "~1.2.36",
"@fortawesome/free-brands-svg-icons": "^5.15.4",
"@fortawesome/free-regular-svg-icons": "^5.15.4",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"@nguniversal/express-engine": "^13.0.2",
"express": "^4.15.2",
"firebase": "^9.6.6",
"leo-profanity": "^1.5.0",
"rxjs": "~6.6.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~13.2.2",
"@angular/cli": "~13.2.2",
"@angular/compiler-cli": "~13.2.1",
"@nguniversal/builders": "^13.0.2",
"@types/express": "^4.17.0",
"@types/jasmine": "~3.8.0",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"eslint": "^8.8.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.25.4",
"jasmine-core": "~3.8.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"sass-lint": "^1.13.1",
"typescript": "~4.5.5"
}
tsconfig.server.json
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.app.json",
"compilerOptions": {
"outDir": "./out-tsc/server",
"target": "es2019",
"types": [
"node"
]
},
"files": [
"server.ts"
],
"angularCompilerOptions": {
"entryModule": "./src/app/app.server.module#AppServerModule"
}
}
版本
