-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
Not using paths from tsconfig #219
Comments
This would be a runtime error. TypeScript does not rewrite the paths for you. Node does not know where to find your paths based on your configuration. Please see the existing issue: #138. |
For any search-engine travellers reading this, tsconfig.json
package.json
Then imports like these works for
|
Guys, this is a very useful workaround with NODE_PATH should be somewhere in README file. I stuck in two hours with baseUrl/paths problem while not found it in closed issues :) |
For those interested I did a PR to enable execution of projects with tsconfig paths in #254. |
@MrCrimp @mnasyrov I also used the NODE_PATH work-around, but this can now be solved easier with the tsconfig-paths package. Just add it as a dev dependency and use the |
Thanks for this hint! I guess to make it work through nyc all it takes is: .nycrc.json ...
"require": [
"ts-node/register",
"tsconfig-paths/register"
],
... |
Typescript 2.0 has added support for having modules in other places than node_modules with the paths property. More info can be found in the documentation.
When running with ts-node this does not work. It just gives me the error that the module cannot be found.
test1.ts
lib/foo/index.ts:
Then running
Same error with this tsconfig.json
Running
tsc
worksThe text was updated successfully, but these errors were encountered: