-
Notifications
You must be signed in to change notification settings - Fork 373
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
Rails 6 compatibility / Instructions #191
Comments
I think the answer is, just use yarn & webpacker. |
Yeah. You can just install it directly from Yarn and forget about this gem |
I'm using Yarn and getting |
The issue is jQuery is not being exposed so the select2 plugin cannot be attached
So make sure you load JQuery in # app/config/webpack/environment.js
run
|
If you have the following error:
replace the environment.loaders.append("jquery", {
test: require.resolve("jquery"),
use: [
{ loader: "expose-loader", options: { exposes: ["$", "jQuery"] } },
],
}); |
I tried including the suggested expose-loader snippets but kept getting another error:
As a workaround, I found this stackoverflow thread and made the following changes to make select2 work in Rails 6 while no longer needing to install expose-loader:
I found that including Also my apologies for the mention of this issue in my repo. Keep forgetting not to document links to other repos. |
How / Can I use this with Rails 6 and webpacker. Including the scss is fine, but I'm trying to require the js like this in app/javasript/packs/application.js
require("select2")
and get Module not found: Error: Can't resolve 'select2'
The text was updated successfully, but these errors were encountered: