How to use ESBuild in Rails with JSBundling Discussion
This is awesome, I have been using it for a couple of weeks now. I didn’t necessarily think webpacker was slow, except maybe on Heroku builds. But when you use this, you wonder why you put up with webpacker for so long :)
Does it make sense to have esbuild-rails built into Rails? And should the esbuild.config.js file go in the /config folder or do files in that folder have to be Ruby?
Not really. They tried that with webpacker and it didn't work because things change so often and every app needs flexibility to adjust for their use case.
The way JSbundling is setup, you can use any tools you want. The only requirement is they dump to the asset pipeline. That's super flexible and you can make any changes you need. Great balance I'd say.
JSX/React, yeah esbuild actually comes with support for JSX and typescript I believe, all built in with no configuration needed.
You may even consider looking into vite-ruby.
Vite uses esbuild for building the JS, but it also lets you build your CSS just as fast with built in live reloading.