I have a node/typescript project structured like so:
- node_modules // => these are loaded npm/package.json
- src
- node_modules // => shared modules for my project, not on npm
- lib.ts
- app.ts
- package.json
I have a secondary node_modules
folder for my private packages mainly so I can import them from anywhere in my project and not have to worry about relative paths (as suggested here) on imports.
This works great because instead of import * as lib from '../../lib'
or var lib = require('../../lib')
, I can import * as lib from 'lib'
.
Typescript compiles/loads lib
w/o problem, but VS Code intellisense complains that it "cannot find module 'lib'".
FWIW, here is my tsconfig.json
{
"compilerOptions": {
"experimentalDecorators": false,
"emitDecoratorMetadata": false,
"module": "commonjs",
"target": "es2015",
"rootDir": "src"
}
}