Issue with Typescript Aliases #4288
Unanswered
RoyalVICTOR-pro
asked this question in
Help
Replies: 1 comment
-
Some news here, so it can help others : @RomainLanz helped me on Discord with the first problem (aliases who didn't work locally), here is the solution : First, I didn't specify that in my initial question but you have to declare paths in .adonisrc file like that : //...
"aliases": {
"App": "app",
"Config": "config",
"Database": "database",
"Contracts": "contracts",
"@Models": "app/Models",
"@Controllers": "app/Controllers/Http",
"@Services": "app/Services",
"@DTO": "app/DataAccessLayer/DTO",
"@DALInterfaces": "app/DataAccessLayer/Interfaces",
"@DALRepositories": "app/DataAccessLayer/Repositories",
"@Enums": "app/Enums",
"@Validators": "app/Validators"
},
//... And be carefull of not keeping the /* in aliases and paths : Where I had
Romain makes me change it to :
and now it works ! Thanks to him ! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi !
In AdonisJS, I use TypeScript aliases:
Firstly, some aliases don't work locally, but others do.
For a file located at ./app/Services/AuthService.ts:
If I do that I get an error:
If I do that It works:
I don't understand why.
Secondly, when I try to run "npm run build" in production from the terminal, I get an error:
If I replace the path:
with the actual relative path:
then it works.
I've seen similar issues on the internet; is there a proper way to handle this in AdonisJS?
Just a clarification, when I build in production, all aliases come up with errors.
Beta Was this translation helpful? Give feedback.
All reactions