Webpack - $(...).slick is not a function
See original GitHub issueHello,
I’m trying to use webpack to bundle all my js files and libraries. So far it works well for other plugins but when calling and using slick, I’m getting a: Uncaught TypeError: $(…).slick is not a function
Main JS file codes:
global.jQuery = require('./vendor/jquery/dist/jquery');
window.$ = global.$ = global.jQuery;
//Add bootstrap & libraries
require('./vendor/bootstrap/dist/js/bootstrap');
require('./vendor/slick-carousel/slick/slick');
$(document).ready(function(){
$(".slider").slick({
infinite: false
});
});
ps: “vendor” is the custom name given for “bower_components”
my webpack config:
var config = {
watch: false,
output: {
filename: 'app.js'
},
plugins: [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
mangle: {
except: ['$super', '$', 'exports', 'require']
},
output: {
comments: false
}
})
],
devtool: 'source-map'
}
What is observed behaviour?
Slick carousel is not being executed.
More Details
- Which browsers/versions does it happen on? Chrome 49 Firefox 44.0.2
- Which jQuery/Slick version are you using? jQuery 2.2.3/Slick 1.5.9
- Did this work before? Yes, before webpack integration
Issue Analytics
- State:
- Created 7 years ago
- Comments:17
Top Results From Across the Web
Slick Carousel Uncaught TypeError: $(...).slick is not a function
I found out that that means that the code has been loaded before the DOM was loaded, which is correct (I think). Edit:...
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 >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 it...
Read more >Uncaught TypeError: $().kendoGrid is not a function - Telerik
I am trying to use Kendo Grid in a view. In the main index.html I have reference for the required css and js...
Read more >Uncaught TypeError | Is Not A Function | Solution - YouTube
Have you encountered an error like:- Uncaught TypeError- Some selector is not a function - jQuery is not a function - owlCarousel is...
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
Hello,
I’ve found the fix for the issue; it by declaring jquery as global in the webpack configuration:
http://stackoverflow.com/questions/28969861/managing-jquery-plugin-dependency-in-webpack
Point 2:
Thanks
or just