'How to make angular find imports automatically in vs code
I have a angular project generated with nrwl/nx, I generated an model folder manually, but if I try to import something from it I have to do it manually. Is there anyway to make a file where I can put the path to my models and it will automatically be found?
I looked a bit and found this in my tsconfig.base.json
{
"compileOnSave": false,
"compilerOptions": {
"rootDir": ".",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"module": "esnext",
"lib": ["es2017", "dom"],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": ".",
"paths": {
"@moniesta-admin/auth-lib": ["libs/auth-lib/src/index.ts"],
}
},
"exclude": ["node_modules", "tmp"]
}
I tried to add it like my auth-lib folder but that does not work either. This is how the index.ts of auth-lib looks:
export * from './lib/auth-lib.module';
EDIT:
I tried to add my model like this:
"@moniesta-admin/model": ["model/index.ts"],
this is how the index.ts looks:
export * from '../models/*'
but this gives me the following error: the typedeclaration or module was not found
EDIT v2:
Command is the following: ng g @nrwl/angular:lib
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


