JBeckton
JBeckton

Reputation: 7111

Typescript transpile in browser vs pre-compile js files

I have Googled this a lot and cannot seem to find anything on this topic. I have been working on a Typescript Angular 2 application and have my tooling set up to compile my .ts files into JavaScript locally and the JavaScript files are served to the browser.

I just recently realized that I can include the typescript.js and tweak the System.config a little and avoid having to compile the .ts files locally and allow it to happen in the browser at run time.

My question, is in browser transpilation an issue? Should I be concerned with performance as my app grows larger? Common sense tells me yes but I was looking for some feedback from those that have experience with this set up.

Upvotes: 8

Views: 1977

Answers (2)

Claude
Claude

Reputation: 417

But with so many browsers supporting ES6 wouldn't transpiling in the browsers make sense since it will only transpile what is not supported?

Upvotes: -2

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657068

Browser compilation is nice for creating a Plunker or similar but for production definitely go with transpiling before deployment. Performance and download size and time will suffer with in-browser transpilation.

Upvotes: 7

Related Questions