enapupe
enapupe

Reputation: 17019

TypeScript build into single file with all external dependencies (node_modules) within it

Is it possible to build a TS source into a single file, which would also contain node_modules imported packages' source?

That would be very helpful in a serverless project. I have done this before on a non-TS project but was using webpack (for another reason).

It seems this was briefly possible before but was due a bug https://github.com/Microsoft/TypeScript/issues/13414 ?

Upvotes: 2

Views: 2538

Answers (1)

Benjamin Parnell
Benjamin Parnell

Reputation: 500

You will need to use a bundler such as webpack to bundle your compiled code and all your node_modules dependencies. The TypeScript compiler (tsc) just transforms TypeScript code into JavaScript, and won't deal with bundling.

Upvotes: 5

Related Questions