Trying to implement SSR in my angular application, but encountering an error when running npm run build:ssr
.
I've created my own library named @asfc/shared
, which is bundled in the dist folder.
ERROR in projects/asfc-web/src/environments/environment.ts:1:39 - error TS2307: Cannot find module '@asfc/shared' or its corresponding type declarations.
1 import { PageNotFoundComponent } from '@asfc/shared';
~~~~~~~~~~~~~~
......
I have included index.ts in the files
section, but the error persists.
Here is my tsconfig.server.json
:
{
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"removeComments": false,
"strict": false,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noImplicitAny": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"experimentalDecorators": true,
"pretty": true,
"declaration": true,
"outDir": "../../dist/server",
"lib": ["es2016", "DOM"],
"types": [
"node"
],
"typeRoots": [
"node_modules/@types"
]
},
"files": [
"server.ts",
"../../dist/asfc-shared/public_api.d.ts"
],
"angularCompilerOptions": {
"entryModule": "../../projects/asfc-web/src/app/app.server.module.ts#AppServerModule"
},
"exclude": [
"node_modules",
"dist"
]
}
Dist Libs structure:
dist/asfc-shared
├── asfc-shared.d.ts
├── package.json
├── public_api.d.ts
Please assist with resolving this issue. Thank you.