New Discussion

Notifications

You’re not receiving notifications from this thread.

Uncaught Error: If you load both jquery_ujs and rails-ujs, use rails-ujs only.

0
Javascript

I have a rails 6.1 application that uses jquery. Here is how I'm importing it in my config/webpack/environments.js file:

$: 'jquery/src/jquery',
jQuery: 'jquery/src/jquery',
jquery: 'jquery',
'window.jQuery': 'jquery'

I am trying to use this the stimulus-sortable component from here:
https://stimulus-components.netlify.app/docs/stimulus-sortable/

Which causes this error: Uncaught Error: If you load both jquery_ujs and rails-ujs, use rails-ujs only.

I can resolve the error by either removing jquery entirely, or removing rails ujs from my application.js file.

It appears to be specific to the stimulus-sortable component, although I'm not sure what is causing that to throw this error, as I am not importing jquery-ujs.

Any help or advice would be greatly appreciated. At this point, I'm probably just going to write my own stimulus controller.

Join the discussion
Create an account Log in

Learning Ruby on Rails? Join our newsletter.

We won't send you spam. Unsubscribe at any time.