पाठ 28 / 31
आधुनिक विकल्प: esbuild, Oxc और Native TypeScript
Babel और SWC की तुलना esbuild, Oxc और Node की built-in type stripping से करें, और सबसे हल्का उपयुक्त tool चुनें।
और तेज़ विकल्प
esbuild (Go) JSX और TypeScript बहुत तेज़ी से transpile करता है और कई bundlers को चलाता है। Oxc और Rolldown (Rust) नए tools हैं जिन्हें Vite अपना रहा है। इनमें से कोई type-check नहीं करता और ये हर Babel plugin की नकल नहीं करते।
बिना build step के TypeScript चलाएँ
हाल के Node.js versions सरल TypeScript types native रूप से हटा सकते हैं, इसलिए छोटे scripts को transpiler की जरूरत ही नहीं।
# Node.js 22.18+ / 24 can run .ts files that use erasable syntax only
node script.ts
# esbuild: transpile and bundle quickly
npx esbuild src/index.ts --bundle --outfile=dist/index.js --target=es2022अपने targets पूरे करने वाला सबसे हल्का tool चुनें। Babel केवल तब रखें जब आप विशिष्ट plugins पर निर्भर हों, और type safety के लिए हमेशा tsc --noEmit चलाएँ।