Reputation: 522
I am trying to create a simple TypeScript project in WebStorm that imports a Node.js module. I have downloaded the relevant library TypeScript definition in settings and have specified --module commonjs
in compiler settings, but I am receiving a Cannot find external module
error when I try to actually import the module.
This is the most basic example I can think of. What am I missing here?
Upvotes: 4
Views: 2442
Reputation: 1543
If you are using tsconfig.json then you can tell WebStorm to use it. Search for it under Languanges & Frameworks > TypeScript
Upvotes: 0
Reputation: 665
I think you may need at the very top of your file:
/// <reference path="node.d.ts" />
I'm not yet sure how to reference the Definitely Type node definitions you've downloaded inside the Webstorm IDE.
Try manually download node.d.ts from:
https://github.com/borisyankov/DefinitelyTyped/blob/master/node/node.d.ts
and drop it into your working directory.
Upvotes: 2