-
Notifications
You must be signed in to change notification settings - Fork 21.9k
"If you load both jquery_ujs and rails-ujs, use rails-ujs only." when rails-ujs
imported twice
#40584
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
Comments
rails-ujs
imported twice
I guess moving these 5 lines under rails/actionview/app/assets/javascripts/rails-ujs/start.coffee Lines 13 to 17 in 53331b4
However, this change corrupts apps that uses |
This behavior was from 9df747c |
I remove the jquery and its working properly <%= javascript_pack_tag 'bundle_a' %>
<%= javascript_pack_tag 'bundle_b' %> |
Yes, of course. It means you cannot use rails-ujs with jquery(or you can use it a limited way). |
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
Uh oh!
There was an error while loading. Please reload this page.
Steps to reproduce
You use two JS bundles on a page and both of them import
rails-ujs
.In addition to that, that page exposes
jQuery
in the global space.Expected behavior
rails-ujs
in each JS bundlecsrfToken()
in each JS bundleActual behavior
page.html.erb
crush with a runtime error which says'If you load both jquery_ujs and rails-ujs, use rails-ujs only.
The line throws this error is here:
rails/actionview/app/assets/javascripts/rails-ujs/start.coffee
Lines 13 to 15 in 53331b4
System configuration
Rails version:
5.2.4.3
Ruby version:
2.6.5
The text was updated successfully, but these errors were encountered: