Fix build for legacy browsers
yaaax opened this issue · 2 comments
It looks like it's not feasible to transpile to ES5 using only esbuild and babel.
Let's try Vite ?
Some useful links:
- Vite HUGO Plugin
- Faster development experience with Vite, Hugo and Preact (we don't use Preact but the 2 others yes 😉)
- Vite plugin legacy
Interesting read:
ESBuild doesn't transpile your code down to ES5
swc (https://swc.rs/) does transpilation and it's as fast as esbuild. Setup is slightly more complex. I'm hoping esbuild will add ES5 transforms at some point, would much rather have a Go tool underneath.
IE (all versions) seems to have 1-2% market share, so I'm not sure it's worth jumping through hoops for.
Sadly it's a lot more than old IE versions, there are a lot of mobile devices with surprisingly old/buggy browsers around. Of course this is highly dependent on the target audience but at my last job we did some runtime feature detection (basic stuff like arrow functions, let/const...) and shipped a modern build or a legacy build. And something like 10% of users got the legacy build, most of them on mobile browsers.
Check also SWC. Maybe less stable at the moment?
Cette issue a été marquée comme inactive car elle n'a pas eu de mise à jour depuis 30 jours. Si elle n'est pas mise à jour d'ici 7 jours, elle sera fermée automatiquement. Pour éviter qu'elle soit fermée, vous pouvez ajouter le label keep open
.
Cette issue a été fermée car elle est inactive depuis 37 jours. Si vous pensez que c'est une erreur, vous pouvez la rouvrir.