jquery-match-height
jquery-match-height copied to clipboard
Plugin not working with webpack require
Plugin is not working with webpack require or import. After require $.fn.matchHeight not defined.
show-category.js:7 Uncaught TypeError: $(...).matchHeight is not a function
+1
I got this package working fine in my webpack setup with the following:
webpack.config.js
:
const webpack = require('webpack')
module.exports = {
externals: {
'jquery': 'jQuery'
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
})
],
};
(Note that's just a fragment of my webpack setup, using it standalone wont work ⚠️ )
app.js
(where I wanted to include matchheight):
import 'jquery-match-height'
Hope it helps! 🙂
Awesome, this helped.
If what @breadadams says works, then maybe just this might also work in your webpack.config.js
?
externals: {
'jquery': {
commonjs: 'jquery',
commonjs2: 'jquery',
amd: 'jquery',
root: 'jQuery'
}
}
Does anybody know if there's an easy change to the plugin that will mean this isn't needed?