Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to include JavaScript files as part of my build?

Is it possible to put a reference in my code to .js files and have typescript combine them as part of its final build?

What I'm trying to obviate here is the need for any tools that do combining, script tags, or requiring a loader when all I'm producing are internal modules.

Note: I am not talking about .d.ts files which I'm aware of. I'm looking for ways to include the actual JavaScript files in the .js output from tsc.

like image 476
Alexander Trauzzi Avatar asked Mar 12 '15 11:03

Alexander Trauzzi


1 Answers

I tried to include js file with this, and it worked. The js files are added to the build folder.

{
    "compilerOptions": {
        ...
        "allowJs": true,
        "outDir": "./build/",
        ...
    },
    "include": ["src/**/*"],
    "exclude": ["node_modules", "**/*.spec.ts"]
}
like image 134
leogoesger Avatar answered Oct 03 '22 22:10

leogoesger