Open bovender opened 4 years ago
It's probably too late for this to be helpful to you, but for anyone who finds this issue like I did, here's my solution. I'm using Rails with webpack. In my config/webpack/environment.js file I had:
const webpack = require('webpack')
environment.plugins.prepend('Provide',
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
})
)
The problem was fixed by adding 'window.jQuery': 'jquery'.
const webpack = require('webpack')
environment.plugins.prepend('Provide',
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery' // added here
})
)
In the past I used Garlic.js with great success, but now that I use webpack to compile my assets, I get this error in the browser console:
My entry point contains this:
And it does not matter whether I change this to:
I must admit that I am not very good at all at JavaScript, so I would not be surprised if the solution is really simple?