go back

ts-loader and babel-loader | hensel and gretel

🚨Short story alert.🚨
Directly quoting from stackoverflow


ts-loader: convert typescript (es6) to javascript (es6)
babel-loader: converts javascript (es6) to javascript (es5) and Typescript doesn't do polyfills, which babel does. If you write client-side
code in es6 and want it to run on modern browsers, you'd probably need babel's polyfills.

Backstory

The thing is I was working to enable tree shaking in our project when I ran into this issue. Turns out (after hours of research) that tree shaking will only work if bebel does it's magic after ts-loader does it's stuff. 🤯

#babel #loaders
Copyright © 2021 Bisvarup Mukherjee
counter freeViews