'Will my code be transpiled twice if I use TypeScript in a Vue.js 3 project?

I'm not very experienced in either TypeScript, Vue, or the Node ecosystem.

I have a working setup created using Vue CLI, with Vue 3 and TypeScript, pretty much unchanged from how vue create produced the project and configuration. If I understand it correctly, Babel will refer to the "browserslist" configuration in my package.json and add polyfills / rewrite code to work with legacy browsers. The TypeScript compiler has --target and --lib options as well, which appear to do something similar.

Is the TypeScript code I write in my Vue project transpiled twice, first by the TypeScript compiler and then by Babel? If so, is there a way to avoid this redundancy?


Editing to add: I just created a new blank project with the above settings, and was asked if I wanted to "Use Babel alongside TypeScript (required for modern mode, auto-detected polyfills, transpiling JSX)". I don't use JSX in Vue, but who could say no to "modern mode," whatever that is.



Solution 1:[1]

I know this is quite old, but for anyone finding this,

TypeScript can be transpiled by babel or by the typescript compiler, usually projects that use babel will also transpile typescript with babel. In that case the typescript compiler will only handle types files (.d.ts)

Even if you are using the typescript compiler to transpile your ts code and use babel to transpile again, which is not the usual setup, it's still perfectly fine

So most likely you code is not transpiled twice

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lk77