cAMPy cAMPy - 5 months ago 15
Javascript Question

Exclude file from Typescript compile effect into one output JS in Visual Studio

I have a typescript project which I compile to a single file with VS. Everything works fine, but there is one library that I already have in the target environment and since it's 3000lines I want to exclude it from compiling to the output file. Unfortunately this library is not a d.ts file, simply .ts one. Is there a way to exclude it from compilation?

Answer

In your tsconfig.json add it to the exclude array

"exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts",

    "path/to/the/file.ts"
]