[webpack | slick-carousel] Webpack cannot find properly path for slick files
See original GitHub issueHello guys, I started to using a webpack bundler, and i got a little issue with slick slider. Slick fonts and gif doesn’t load properly
screenshot of error
It looks like webpack skips main folder, where my project is, and looking for files in d:/node_modules instead of d:/main_folder/node_modules
I was trying to fix this by creating slick-fix.scss and set font and loader path
but i doesn’t work properly
slick-fix.scss
$slick-loader-path: "/node_modules/slick-carousel/slick/" !default;
$slick-font-path: "/node_modules/slick-carousel/slick/fonts/" !default;
main.scss imports
@import "slick-fix";
@import "~slick-carousel/slick/slick.scss";
@import "~slick-carousel/slick/slick-theme.scss";
main.js
require('./styles/main.scss');
require('jquery');
import 'slick-carousel/slick/slick';
$('.slider').slick();
webpack.config.js is on jsfiddle, because of better readability. I hope that ill got any respond, thanks in advance
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6
Top GitHub Comments
It’s working for me using
file-loader
)both of these ways:
…so I think this issue is related to Webpack configuration, not Slick.
If you run into this issue, I recommend you to
resolve.roots
option of Webpack and try to set it to your project root (where your node_modules folder is) as an absolute pathresolve.modules
option of WebpackI’m using laravel mix as a webpack wrapper, I needed to copy both fonts and loader image to my project’s assets and then use my own asset URLs in the slick sass variables.