malihu / malihu-custom-scrollbar-plugin

Highly customizable custom scrollbar jQuery plugin, featuring vertical/horizontal scrollbars, scrolling momentum, mouse-wheel, keyboard and touch support etc.
http://manos.malihu.gr/jquery-custom-content-scroller
MIT License
4.11k stars 1.51k forks source link

import jquery.mCustomScrollbar.css webpack build error #593

Closed tangsj closed 6 years ago

tangsj commented 6 years ago

in my index.js use:

import 'malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css';

build Error:

ERROR in ./node_modules/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css Module build failed: ReferenceError: window is not defined

my webpack build config:

{ test: /jquery-mousewheel/, loader: "imports-loader?define=>false&this=>window" }, { test: /malihu-custom-scrollbar-plugin/, loader: "imports-loader?define=>false&this=>window"},

{ test: /.css$/i, use: ExtractTextPlugin.extract({ fallback: 'style-loader', use: [ { loader: 'css-loader', options: { sourceMap: true, }, }, { loader: 'postcss-loader', }, ], }), },

AmorDiamond commented 6 years ago

When used in webpack, the folder name where jquery.mCustomScrollbar.min.css is placed must not contain malihu-custom-scrollbar-plugin. This will not use the imports-loader to load, and use css-loader to load

dbk1985 commented 5 years ago

doing like this, working well !! {test: /jquery-mousewheel/, loader: "imports-loader?define=>false&this=>window"}, {test: /malihu-custom-scrollbar-plugin\/**\/*.js/, loader: "imports-loader?define=>false&this=>window"}, { test: /.css$/, use: ExtractTextPlugin.extract({ fallback: "style-loader", use: "css-loader" }) }, { test: /.(png|svg|jpg|gif)$/, use: [ 'file-loader' ] }