Re:Why we switched from Webpack to Vite
by fiddlerwoaroof on Wednesday April 28, 2021 @04:52PM
(#26974049)
The new URL() thing is amazing
Re:Why we switched from Webpack to Vite
by netghost on Wednesday April 28, 2021 @05:33PM
(#26974501)
Can someone clarify what the new URL() thing is?
Re:Why we switched from Webpack to Vite
by fiddlerwoaroof on Wednesday April 28, 2021 @05:38PM
(#26974558)
this is the release notes for it:
https://webpack.js.org/blog/2020-10-10-webpack-5-release/#as...
I can remove babel in my code?
Re:Why we switched from Webpack to Vite
by fiddlerwoaroof on Wednesday April 28, 2021 @05:19PM
(#26974344)
It depends on your target platform: ES6 modules are basically supported in every browser I care about, so the major reason for Babel is JSX
Even if your target platform didn't have ES6 modules, Babel is probably not the tool you'd want to transpile those with. Let the bundler (which is the topic of the discussion here so I assume a bundler is used) handle them. Tree shaking works better that way anyway.
Also if JSX or similar JS extensions are the only thing you need tramspiling for, you might want to look at Sucrase [1] as a fast alternative to Babel.
Personally I removed it years ago, and Webpack 5 even allowed me to get rid of more loaders now that there are Assets Modules that automatically detect assets and webworkers using the "new URL()" syntax, and Typescript does everything else I need.