Reputation: 301
So, I have a custom npm package that we're trying to use in my company. This package is completely typescript, so I try to build it. However Typescript ignores node_modules by default so I made my tsconfig like this:
{
"compilerOptions": {
"noImplicitAny": false,
"removeComments": false,
"preserveConstEnums": true,
"target": "ES5",
"sourceMap": true,
"listFiles": true
},
"files": [
"typings/index.d.ts",
"node_modules/custom_module/**/*.ts",
"app/**/*.ts"
]
}
This builds just fine with gulp-typescript, however the Visual Studio build is not so cooperative and can't even recognise things like angular. And it needs to build in VS for automated release.
I've tried replacing "files with "include" and then it can find angular etc, but still not our custom module. And gulp-typescript also can't find our module then.
Is there anything I might need to add/remove here?
Upvotes: 0
Views: 125
Reputation: 31600
Your node module should come in the form of transpiled Javascript code and definition files that describe it, not as TypeScript code that you have to compile yourself again.
Doing so would create a very brittle build environment since you'd have to replicate their build setup into yours.
You should only have to include the .d.ts files (the ones in the node_modules are automatically included by tsc) and if you use a module loader map the module to the proper Javascript files.
Upvotes: 1