Closed wayc closed 1 year ago
Nice work. Are these the only changes you made to get rails_admin running with esbuild? I'm struggling to get it to work.
Nice work. Are these the only changes you made to get rails_admin running with esbuild? I'm struggling to get it to work.
@rjaus Hi there 👋
Yes, the changes in this PR allowed esbuild to build successfully. However, our migration from webpacker to esbuild took some effort. If you're in a similar situation, you can try creating a new separate Rails project on esbuild: rails new demo-rails -j esbuild
and implementing rails_admin
. Then you can diff between your new and existing projects to identify areas to change.
It looks like a few test suites are failing here—I'll sort them out soon.
@mshibuya @pcai
Thank you so much for resolving the failing JRuby tests in https://github.com/railsadminteam/rails_admin/pull/3574
I've marked this PR (on jQuery initialisation) as ready to review and would love to hear your thoughts.
Hello, any updates on this?
Confirmed to work, thanks!
Background
During our migration from webpacker to esbuild, our apps using
rails_admin
began to fail during builds, along with Chrome showing ajQuery is not defined
error in the Console:We traced the root cause to the order of these actions in
src/rails_admin/base.js
:jquery
jquery-ui
window.$ = window.jQuery = jQuery;
The
jquery-ui
modules are imported beforewindow.$
is defined, causing the above issues.To add support for esbuild and to avoid issues with async and hoisting, we suggest importing and initialising
jQuery
together.Changes