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
ts-node cannot import pure typescript npm module inside node_modules directory #158
Comments
Isn't this a duplicate of #155? We don't enable TypeScript modules in |
That's look weird, because we have got a lot libraries which doesn't compiled properly.. Is there any option to replace import folder for |
@glebmachine Sure. Check the README or the linked issue. |
I had wroten a pure typescript npm module(without any .js file), and want to use it in my server project which use ts-node(without any compile work like tsc) to run directly. because my case is a server environment, so startup time is not a problem.
the problem is: ts-node cannot use
import
to load pure typescript insidenode_modules
directory, I had to do a little hack(move it out, use soft link to link it back).Which cannot run:
Which could run
my hack is: move
wechaty-io
module directory out of node_modules, then use soft link to link it back$ npm install $ mv node_modules/wechaty-io . $ ln -s ../wechaty-io node_modules/ $ ts-node bin/index.ts info io-server Listening on 8080 info io-server init succeed
It seems the
import
in ts-node will not work when the pure typescript module is innode_modules
directory. But, after we changed the physics directory out ofnode_modules
directory,ts-node
will makeimport
work properly.Is there any better solution to do this? Thanks.
The text was updated successfully, but these errors were encountered: