ide-typescript icon indicating copy to clipboard operation
ide-typescript copied to clipboard

imported node_modules packages not resolved if editor not opened at project root

Open aryzing opened this issue 7 years ago • 0 comments

So say a repository's root is at ~/project, meaning the following files exist (among others):

~/project/package.json
~/project/node_modules
~/project/src/index.ts
~/project/src/tsconfig.json

Opening the editor at atom ~/project/src will cause all imports targeting node modules to be marked as missing: "Cannot find module xxx". Typescript, though, has no problem resolving modules as expected,

cd ~/project/src
../node_modules/.bin/tsc # works just fine and transpiles files as expected

The result of running the commands above will be the creation of an index.js file with the appropriate imports as configured in tsconfig.json.

aryzing avatar Apr 13 '18 21:04 aryzing