[TRI-3988] Support imports with aliases inside the trigger.config file
Opened this issue · 1 comments
Problem
If you are using imports in your trigger.config file with aliases you've defined in your tsconfig.json paths, you will get an error like this:
X Error: Cannot find module '@services/environment'
You can't use import aliases that you've setup in your tsconfig.json file inside of the trigger.config.ts file. They work in all other files inside the /trigger folder but just not in this file.
They don't work because we use https://github.com/unjs/c12 to load the config file and it doesn't automatically read tsconfig aliases.
Workaround
If you experience this problem, for now you can change the path to a relative folder path import.
Potential built-in solution
There is an alias
option when using jiti and it looks like we might be able to read the relevant tsconfig paths and populate this with them. https://github.com/unjs/jiti?tab=readme-ov-file#alias
From SyncLinear.com | TRI-3988
Hey @matt-aitken please assign this issue to me?