-
Notifications
You must be signed in to change notification settings - Fork 293
Brokenness with jsbundling-rails? #403
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
@MrJoy Hi, I also use prophaft and jsbundling-rails but for me, it already fails because it expects sprockets to exist. How did you fix this? /usr/local/bundle/gems/sprockets-rails-3.4.2/lib/sprockets/railtie.rb:110:in |
I've forked the repo to remove the Sprockets dependency. https://github.com/FasterBetter/activeadmin_addons_nosprockets So, it seems there's a bit more that's needed to make this work with Propshaft besides what I've discovered. It seems like getting this all sorted out will help add longevity to ActiveAdmin_addons. |
@MrJoy Yes, that's what I also now did. For me, it actually works now, at least the select2 fields I've been using. I haven't tested all features though, e.g. icons and color picket. |
What did you do to get select2 to work? I have been unable to figure out how to make it happen. |
Yeah, that's what I was doing and just not having any luck. |
Specifically, when I try that, I wind up with this from cssbundler:
And, in the browser console when loading up a page:
My JS bundle entrypoint is: import Rails from "@rails/ujs";
Rails.start();
import "@activeadmin/activeadmin";
// N.B. We can't load this because it chokes trying to find Select2 and I have yet to figure out
// how to solve that. Injecting it doesn't seem to work. Importing it doesn't work. Gahhh!
import "activeadmin_addons";
import "arctic_admin";
import "chartkick/chart.js"; And my CSS bundle entrypoint is: @import "activeadmin_addons/src/stylesheets/all";
@import "arctic_admin/src/scss/main";
@import "../active_admin/monkeypatches";
@import "../active_admin/ux";
@import "../active_admin/widgets";
$fa-font-path: ".";
@import "@fortawesome/fontawesome-free/scss/fontawesome";
@import "@fortawesome/fontawesome-free/scss/solid"; To get this far, I had to inject jQuery into the bundle forcibly, as you can see in the actual ticket body. No matter what I do, I can't get it to find select2. |
Part of the issue seems to be import paths. For the CSS, the correct import statement seems to be On the JS side, I have absolutely no idea what's going on, or how to correct it. Forcibly injecting Select2 alongside jQuery/jQuery-UI seems like it should work, but it just... doesn't. |
@joker-777 Can you give your |
One further issue I'm running into using dart-sass is this: @import 'jquery-datetimepicker/build/jquery.datetimepicker.min.css'; It's not liking the |
@MrJoy We have the select2 package installed separately of imports_loaders.js
webpack.config.js
|
So basically, you're using Webpack, not ESBuild. Gotcha. |
Yes, that's what I said, no?
|
We would love to use esbuild but it doesn't support dynamic chungs so well yet. |
You did indeed, and I misread it. My bad. For us, the lack of dynamic chunks is a non-issue as our front-end is a Next.js app with its own build/deploy process and the Rails asset pipeline is only used for the admin system. In our situation, giving up select2 is preferable to dealing with webpack again. That, and switching to this new arrangement let me drop 915 transitive dependencies which makes it eaier to manage license compliance and supply chain security. As such, I'm not terribly inclined to explore the webpack route at this time. I will keep it in mind, in case I encounter other issues. Thank you for the details. |
Thanks, Next.js looks definitely very interesting. |
Hi all, we released a new v2 beta, which, among other things, removes select2 and sprockets support, so we’ll be closing this issue. You can see more details here. Feel free to try it and open a new issue if you find anything there. |
I've got an app on Rails 7 using Propshaft, jsbundling-rails, and cssbundling-rails. It took some herculean effort to get as far as making jQuery / jQuery-UI available to ArcticAdmin (and possibly ActiveAdmin_Addons -- I don't recall), but I am stuck on getting the plugin's NPM module to see Select2.
I'm using the
--inject
option to esbuild to inject jQuery and jQuery-UI but the same trick doesn't seem to work for Select2.Specifically, my package.json looks like this:
And the jquery hack looks like this:
I tried vendoring select2 and importing it the same way, to no avail.
Of course, this all is very much a fairly ugly kludge but I'm not aware of any other way to make things work.
Perhaps you're better situated to get things working under a Propshaft+cssbundling+jsbundling world?
The text was updated successfully, but these errors were encountered: