This gist will modify your babel-loader
in place to use esbuild-loader
instead. Also by default webpacker 5 and below compile your node_modules, so it also modifies the loader for that as well.
Esbuild is a super fast javascript transpiler built in Go. It also uses nice language like: targets: es7
so no more fighting with .browserslistrc
It will also auto transform syntax like: static values = {}
Heres a full list of transforms: https://esbuild.github.io/content-types/#javascript
Esbuild Loader: https://github.com/privatenumber/esbuild-loader
Esbuild: https://esbuild.github.io/
yarn install esbuild-loader
Then modify your config/webpacker/environment.js
to look as above.
Thats it! You can now delete your babel.config.js
and your .browserslistrc
and you can simply target an es{x}
version!
This is not currently working right now, something under the hood with webpacker is still expecting babel....interesting.