Skip to content

Using ts-node with @ imports #1

@robert-cronin

Description

@robert-cronin

Note: this issue is just for documentation and has a solution already:

The issue in question is an error that occurs when using imports that use the @ symbol to denote the module (e.g. import PolyKey from @polykey/PolyKey.ts). It turns out ts-node doesn't like this and throws an error. There is a whole issue about tsconfig.json/paths not working with ts-node. The solution is to use tsconfig-paths and then suffix all your calls with ts-node -r tsconfig-paths/register <file>. One can do this with a handy alias: alias ts-node='ts-node -r tsconfig-paths/register'.

For webpack, there is also a module for this: https://github.com/dividab/tsconfig-paths-webpack-plugin

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions