How to compile typescript with babel 7 cli?
Clash Royale CLAN TAG#URR8PPP
How to compile typescript with babel 7 cli?
This:
babel ./src/MyTypescript.ts --out-dir ./wwwroot/js/
doesn't work (no error, just '0 compiled').
.babelrc
contains everything that Babel 7 need to compile typescript with webpack babel loader: preset "@babel/typescript" and plugin "babel-plugin-transform-class-properties" (pair which works for me with current babel 7 rc01).
.babelrc
just for research and debugging (it is quite complex to extract transpiled TS code from bundle)
– Roman Pokrovskij
Aug 13 at 15:23
I would be very happy if somobody could certainly explain me that @babel/typescript is wrong (or good) idea. Now this dilemma "what to use tsc or preset" - paralyze me.
– Roman Pokrovskij
Aug 13 at 15:35
1 Answer
1
Here is an answer:
babel ./src/MyTypescript.ts --out-dir ./wwwroot/js/ --extensions '.ts,.js'
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Why do you want to use babel with typescript? Why don't you simply use typescript compiler?
– Akash Kava
Aug 13 at 14:56