-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define jQuery object in separate file to support esbuild #3571
Conversation
Changes unknown |
Nice work. Are these the only changes you made to get rails_admin running with esbuild? I'm struggling to get it to work. |
61d2b15
to
32a5f84
Compare
@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: It looks like a few test suites are failing here—I'll sort them out soon. |
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