You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
matt-aitken
changed the title
Support imports with aliases inside the trigger.config file
[TRI-3988] Support imports with aliases inside the trigger.config file
Nov 13, 2024
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:
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.
unjs/jiti#166
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#aliasFrom SyncLinear.com | TRI-3988
The text was updated successfully, but these errors were encountered: