小编Mas*_*erX的帖子

Angular 找不到我的自定义库的模块

我在我的角度应用程序中实现 SSR,在尝试运行npm run build:ssr它时会抛出以下错误。

\n

我已经创建了自己的库,它是否以名称捆绑在 dist 文件夹中@asfc/shared

\n
ERROR in projects/asfc-web/src/environments/environment.ts:1:39 - error TS2307: Cannot find module '@asfc/shared' or its corresponding type declarations.\n\n1 import { PageNotFoundComponent } from '@asfc/shared';\n                                        ~~~~~~~~~~~~~~\n......\n
Run Code Online (Sandbox Code Playgroud)\n

我已将 index.ts 添加到files,但错误仍然没有消失

\n

下面是我的,tsconfig.server.json

\n
{\n  "compilerOptions": {\n    "target": "es2016",\n    "module": "commonjs",\n    "moduleResolution": "node",\n    "allowSyntheticDefaultImports": true,\n    "removeComments": false,\n    "strict": false,\n    "noFallthroughCasesInSwitch": true,\n    "noImplicitReturns": true,\n    "noImplicitAny": false,\n    "noUnusedLocals": false,\n    "noUnusedParameters": false,\n    "experimentalDecorators": true,\n    "pretty": true,\n    "declaration": true,\n    "outDir": "../../dist/server",\n    "lib": ["es2016", "DOM"],\n …
Run Code Online (Sandbox Code Playgroud)

typescript server-side-rendering angular-universal angular

1
推荐指数
1
解决办法
1万
查看次数