#separate entry points with ng-packagr
7 messages · Page 1 of 1 (latest)
An Angular library helps share code across projects.
This guide shows how to create a library with subentry points,
manage dependencies, and add a showcase app.
thx this helps a bit, I'm struggling with imports from different folder
src/app
|models
|services
and importing a model from services results in:
import { CustomHttpParams } from '../../models';
src/app/services/http/bank.service.ts:8:34 - error TS6059: File 'D:/Workspaces/frontend//src/app/models/index.ts' is not under 'rootDir' 'D:\Workspaces\frontend\i\src\app\services'. 'rootDir' is expected to contain all source files.
8 import { CustomHttpParams } from '../../models';
I don't really understand where that happens with the code you provided. Have you scrolled to https://sandroroth.com/blog/angular-library/#dependencies-between-entry-points
If that does not solve your problem. Can you post a repro?
I'm sorry I cannot provide one. I'm at the section you've linked and I've added an index.ts in each directory and pointed that ng-package.json to it. And as described I've added this to my tsconfig.lib.json
"paths": {
"@comp/*": ["./src/*"],
"@comp/": ["./src/"]
}
I'd assume I could then import from @comp/services/ but my ide can't resolve it and trys to import with ``../../models`
no clue really, is there something I could have a look and?