Angular 7 Universal - 无法解析路径

问题描述 投票:1回答:1

我使用Angular Universal qazxsw poi关注服务器端渲染的这个很棒的教程

但是当运行https://angularfirebase.com/lessons/server-side-rendering-firebase-angular-universal/时,我收到以下错误:

npm run build:ssr && npm run serve:ssr

不知何故,它无法识别我在errors文件中定义的路径。

tsconfig.json文件:

tsconfig.json
angular url-routing angular7 serverside-rendering angular-universal
1个回答
0
投票

我有同样的问题。我的tsconfig.server.json有参数“baseUrl”:“。”。它会覆盖tsconfig.json参数“baseUrl”:“。/”。我刚刚删除它,现在从我的工作

tsconfig.server.json之前

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ],
    "paths": {
      "@auth/*": [
        "src/app/auth/*"
      ],
      "@core/*": [
        "src/app/core/*"
      ],
      "@entities/*": [
        "src/app/entities/*"
      ],
      "@shared/*": [
        "src/app/shared/*"
      ],
      "@env/*": [
        "src/environments/*"
      ],
      "@reducers/*": [
        "src/app/reducers/*"
      ],
    }
  }
}

tsconfig.server.json之后

{
  "extends": "./tsconfig.app.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app-server",
    "baseUrl": "."
  },
  "angularCompilerOptions": {
    "entryModule": "app/app.server.module#AppServerModule"
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.