I am trying to declare a path to a referenced folder which will enable me to write a shorter import statement. how can i make it work with the @resources path
- I am building from /server by running tsc -b
app.ts
this long statement works
import IEntity from
'../../model/src/resources/entity/entity.interface';
this sort one does NOT work
import IEntity from
'@resources/entity/entity.interface';
folder structure:
/
/model
/src
/resources
/entitiy
entity.interface.ts
tsconfig.json
/server
/src
app.ts
tsconfig.json
entity.interface.ts
import { Document } from 'mongoose';
export default interface IEntity extends Document {
name: string;
}
tsconfig.json (under /server)
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": true,
"declarationMap": true,
"outDir": "dist",
// "rootDir": "./",
// "composite": true,
// "isolatedModules": true,
"strict": true,
// "moduleResolution": "node",
"baseUrl": ".",
"paths": {
"@resources" : ["../model/src/resources"]
},
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*"],
"references": [{
"path": "../model/"
}]
}
tsconfig.json (under /model)
{
"compilerOptions": {
"composite": true,
"target": "es2016",
"module": "commonjs",
"outDir": "dist",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
}
}