Slick-carousel and webpack - $(...).slick is not a function. The solution from other issues doesn't work.
See original GitHub issueHello. I’m trying to use slick-carousel and webpack.
I use the solutions from #2290 with ProvidePlupin and esplose-loader. jQuery and Webpack work without error. But still got the error “$(…).slick is not a function”.
Maybe the reason is in the package version in npm? In this repo last version is 1.8.0. In npmjs.com - 1.7.1 (link)
Or I missed a working solution? What kind?
Script code
import $ from 'jquery';
import 'slick-carousel';
$(".slider-wrapper").slick();
Dependencies
"devDependencies": {
...
"webpack": "^2.7.0",
"webpack-stream": "^4.0.0",
},
"dependencies": {
...
"jquery": "2.2.4",
"slick-carousel": "1.7.1",
}
Webpack config
const path = require('path'); //npm module for absolute path like path.resolve(__dirname, './build')
const webpack = require('webpack');
const config = require('./gulp/config.js');
module.exports = {
entry: './'+ config.src.jsEntryPoint,
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, './' + config.dest.js),
},
watch: true, //live-reloading
devtool: 'source-map',
plugins: [
// jQuery globally
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery"
}),
],
module: {
loaders: [
{
test: require.resolve("jquery"),
use: [
{
loader: "expose-loader",
options: "$"
}
]
}
],
}
};
Issue Analytics
- State:
- Created 6 years ago
- Comments:11
Top Results From Across the Web
Slick Carousel Uncaught TypeError: $(...).slick is not a function
If you type in $(...).slick on the console and it reports the error, it means the file is not loaded correctly. – Joy....
Read more >TypeError: $(...).slick is not a function in jQuery | bobbyhadz
To solve the "$(...).slick is not a function" jQuery error, make sure to load the jQuery library before loading the slick library. The...
Read more >Slick Carousel Uncaught TypeError: $(...).slick is not a function
jQuery : Slick Carousel Uncaught TypeError: $(...). slick is not a function [ Beautify Your Computer ...
Read more >Uncaught TypeError | Is Not A Function | Solution - YouTube
Uncaught TypeError | Is Not A Function | Solution ... At one page I have initialized the slider and other page only has...
Read more >jquery 32 1 min js 2 uncaught typeerror slick is not a function
Uncaught TypeError : $().slick is not a function Usually means that you either forgot to include slick.js in the page or you included...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
there is a special place in hell for people who close github issues like this…
This solution helped me to solve the problem: