Closed gabrieletassoni closed 3 years ago
I have no idea, can you reproduce this by using a newly generated rails app?
Hi, thanks for the answer, no, on a newly generated app I cannot reproduce it. But if I use a wrapper gem I created, it does not work. I try to explain better: I think the point lies around the fact I use rails_admin gem in another gem I created (https://github.com/gabrieletassoni/thecore_ui_rails_admin) which I use as a collection of best practices I push in every project I start, and the main app's Gemfile includes my gem, not rails_admin directly. This dependency chain worked well for many years now and on many different projects, but since one month ago the console started to spit out that error after a
bundle update
I managed to silence off it by removing
//= require rails_admin/rails_admin
from my gem's app/assets/javascripts/thecore_ui_rails_admin/thecore_rails_admin.js, but this obviously has the problem of not loading rails admin specific javascripts at all. As soon as I add the //= require rails_admin/rails_admin
again, the error is thrown again and no javascript in the page works anymore.
I tried to give a glance on rails_admin code of commits around that time, but I'm unable to find what has changed.
Thanks
Ok, I'm resolving by adhering to the standard, I have had a lot of overridden layouts and partials, one of them enabling packs and this seems to conflict with rails_admin javascript management. Can't see the time to have railsadmin properly integrated with webpacker ^^
Well, it seems that at least versions 3+ does not work with webpacker. Sample project of @gabrieletassoni seem to use sprockets, while original one (the one that has error) used webpacker.
I've just added RailsAdmin to my Rails and webpacker project, and here's what I'm getting:
filtering-multiselect.js:10 Uncaught TypeError: $.widget is not a function at filtering-multiselect.js:10:1 at ./node_modules/rails_admin/src/rails_admin/filtering-multiselect.js (filtering-multiselect.js:352:1) at __webpack_require__ (bootstrap:769:1) at fn (bootstrap:129:1) at ./node_modules/rails_admin/src/rails_admin/base.js (base.js:1:1) at __webpack_require__ (bootstrap:769:1) at fn (bootstrap:129:1) at ./app/javascript/packs/rails_admin.js (bootstrap:907:1) at __webpack_require__ (bootstrap:769:1) at fn (bootstrap:129:1)
You can easily trace error to line import "jquery-ui/ui/widget"
that actually does not do anything. It should look like jQuery.widget = require("jquery-ui/ui/widget.js");
Today, during development, I think after a bundle update, Chrome's console started to throw this error:
Obviously all the other, custom, javascript in the page is not working anymore, what can be happened? How can I have the javascript working again?
Here is the bundle:
Thank you very much.