You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 inside node_modules directory, I had to do a little hack(move it out, use soft link to link it back).
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 in node_modules directory. But, after we changed the physics directory out of node_modules directory, ts-node will make import work properly.
Isn't this a duplicate of #155? We don't enable TypeScript modules in node_modules, node modules should be JavaScript.
Reacted by Michał Wadas and monsterooo
Reacted by Joe Pea, /V\4X5\/4|2641, Harold Iedema, TuckerD, Kevin Ross, Benno M, Johan Svensson, Shane Vorachek, Luke Tanner, Sxs7513 and 37 more
Reacted by Gleb Mikheev, Chet Corcos, Nicolas Silva dos Santos, Christopher Pappas, Gérard TOKO, Philipp Bräutigam, B1anker, lukasbash, David Meir-Levy, Joe Pea and 19 more
Activity
bug compatible with ts-node issue TypeStrong/ts-node#158
blakeembrey commentedon Jul 26, 2016
Isn't this a duplicate of #155? We don't enable TypeScript modules in
node_modules, node modules should be JavaScript.glebmachine commentedon Jun 19, 2017
Isn't this a duplicate of #155? We don't enable TypeScript modules in node_modules, node modules should be JavaScript.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
node_modules? Or disablenode_modulesignoring?blakeembrey commentedon Jun 21, 2017
@glebmachine Sure. Check the README or the linked issue.