The tsc works fine, vscode can see that the import is correct (it was actually the autoimport in vscode that created the import). But when running with ts-node it fails with error:
Error: Cannot find module '.foo/bar'
Expected behavior:ts-node with tsconfig-paths registered should be able to import the module using non-relative import just as any other folder without a dot.
Additional info:
trying to explicitely add ".foo/*": [ "./.foo/*" ] to paths does not help
importing other folders as non-relative (ie. import { sth } from 'sth') works just fine with this config.
adding "@foo/*": [ "./.foo/*" ] to paths and changing the import to import { baz } from '@foo/bar' works ok, so it's not a problem with what the paths are mapped to. It seems to be a problem with the left-hand side of mapping.
I have a folder
.foo
directly in project root with some modules in it.Somewhere else in the project I do a non-relative import:
In tsconfig I have set
"baseUrl": "."
, there are nopaths
and I added tsconfig-paths:The
tsc
works fine, vscode can see that the import is correct (it was actually the autoimport in vscode that created the import). But when running withts-node
it fails with error:Expected behavior:
ts-node
withtsconfig-paths
registered should be able to import the module using non-relative import just as any other folder without a dot.Additional info:
".foo/*": [ "./.foo/*" ]
topaths
does not helpimport { sth } from 'sth'
) works just fine with this config."@foo/*": [ "./.foo/*" ]
topaths
and changing the import toimport { baz } from '@foo/bar'
works ok, so it's not a problem with what the paths are mapped to. It seems to be a problem with the left-hand side of mapping.