1

My setup looks just like this answer here with browserify-shim and the depends all set up. I'm not getting the issue reported in that question where Browserify is complaining that it can't find the module.

Rather, on page load, I get Uncaught TypeError: $picker.slick is not a function, $picker being a jQuery object. Hoping I can find a definitive solution.

This solution changes code, so ideally we don't do that. There's also this solution for a similar issue but using browserify global transforms. Right now I've got my browserify settings in my package.json and I'm not sure how to translate that.

Also, I'm using Elixir's abstraction of gulp browserify, though not in a Laravel project. WordPress, actually.

Community
  • 1
  • 1
Ethan C
  • 1,408
  • 1
  • 14
  • 26

1 Answers1

0

Try explicitly exporting Slick Carousel as a jQuery plugin, like so:

"browserify": {
  "transform": [
    "browserify-shim"
  ]
},
"browserify-shim": {
  "jquery": "global:jQuery",
  "slick-carousel": {
    "depends": [
      "jquery: jQuery"
    ],
    "exports": "$.fn.slick"
  }
},
YPCrumble
  • 26,610
  • 23
  • 107
  • 172