Repository navigation
Replies: 1 comment 1 reply
|
Your For the CommonJS configuration you posted, install the runtime resolver: npm install --save-dev tsconfig-paths
npx ts-node -r tsconfig-paths/register src/script.tsOr keep your existing compiler options and add this top-level section to "ts-node": {
"require": ["tsconfig-paths/register"]
}I reproduced the |
1 reply
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.
Hello,
I am trying to reuse some already existing TypeScript code, in a script.
I have the following config:
My script runs fine with the following command, when it does not have any import:
npx ts-node src/script.tsHowever, it starts failing as soon as there is an import like this:
import { foo } from "@/bar";Error is:
Cannot find module '@/bar'/code: 'MODULE_NOT_FOUND'Any help would be appreciated 🙏
All reactions