Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TRI-3988] Support imports with aliases inside the trigger.config file #1473

Open
matt-aitken opened this issue Nov 13, 2024 · 1 comment
Open

Comments

@matt-aitken
Copy link
Member

matt-aitken commented 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:

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.

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#alias

From SyncLinear.com | TRI-3988

@matt-aitken 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
@yadavshubham01
Copy link
Contributor

Hey @matt-aitken please assign this issue to me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants