-
Notifications
You must be signed in to change notification settings - Fork 125
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
Filterrific and Rails 6 #198
Comments
To access const webpack = require('webpack')
environment.plugins.prepend('Provide',
new webpack.ProvidePlugin({
$: 'jquery/src/jquery',
jQuery: 'jquery/src/jquery'
})
) |
The only way I have found so far to make this work is by copying the javascript file (filterrific-jquery.js) to the packs folder and adding the following to the application.js file... import { Filterrific } from './filterrific-jquery'; if I point to the filterrific/filterrific-jquery file directly I get it cannot find the module. Anyone else have luck with this? John |
Wondering if anyone has had any luck getting things running with Rails 6 and Webpacker?
I'm confused about the following:
I've added it under 'packs' and then included it into application.js using
require("packs/filterrific-jquery.js");
but it doesn't want to work. I get'Uncaught ReferenceError: $ is not defined'
.Related to above, I normally put the following code into a .js.erb file with the same name as my main view:
I moved this into my view file as it wasn't being triggered by the .js.erb file -- but again run into the
'Uncaught ReferenceError: $ is not defined'
. I have jQuery in my yarn as well as application.js -- sample below:Would really appreciate any feedback or ideas as to what I can try here and the best practice - cant see anything on StackOverflow/other issues.
The text was updated successfully, but these errors were encountered: