How to preserve .erb with jsbundling-rails/ESbuild


I’m trying to drop in jsbundling-rails and ESbuild into sprockets, and wondering how to do old school style unobtrusive JS with .js.erb files. There’s no ESbuild loader for .erb I think, but generally also just wondering if there’s a strategy for preserving these response templates or if it’s possible at all.

E.g. is it possible to read into JS through ESbuild, that previously was possible with embedded ruby?

Nevermind, I realized this question doesn’t quite make sense. But the main question is still, is it possible to server render or process .js.erb files with jsbundling-rails at assets:precompile time?

No. jsbundling is simply a wrapper around esbuild/webpack/rollup, none of which support .erb files. Webpacker (the gem) had this feature I think, but it was deprecated. Maybe shakapacker (its sucessor) can do that?

Yeah, thought so. Thanks!