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
I am having an issue on deployment when using alias with ts-node and typescript
This is my folder structure
Inside the main.ts I import a file like this import { appConfig } from '@base/config/app';
and @base is defined in the tsconfig.json like this
Cannot find module '/var/task/src/config/app'
Require stack:
- /var/task/src/main.js
- /var/task/api/index.js
Did you forget to add it to "dependencies" in `package.json`?
INIT_REPORT Init Duration: 281.56 ms Phase: invoke Status: error Error Type: Runtime.ExitError
Error: Runtime exited with error: exit status 1
Locally it works, and also if I change it to be import { appConfig } from './config/app'; it also works.
How can I make this to work?
I use a util method to fix the aliases for the ts-node on top of the main.ts for the dev environment
import ModuleAlias from 'module-alias';
export function fixModuleAlias(dirName: string) {
ModuleAlias.addAliases({
'@base': dirName,
'@api': dirName + '/api',
});
}
Thanks in advance
The text was updated successfully, but these errors were encountered:
I am having an issue on deployment when using alias with ts-node and typescript
This is my folder structure
Inside the main.ts I import a file like this
import { appConfig } from '@base/config/app';
and @base is defined in the tsconfig.json like this
I am getting this error
Locally it works, and also if I change it to be
import { appConfig } from './config/app';
it also works.How can I make this to work?
I use a util method to fix the aliases for the ts-node on top of the main.ts for the dev environment
Thanks in advance
The text was updated successfully, but these errors were encountered: