jQuery-slimScroll
jQuery-slimScroll copied to clipboard
It don't support with weback
It don't support with weback, just because the variables in the code is global object.
Can you paste your webpack config? It works quite well for me
Hi, @zhangbg .
First, you must install expose-loader
with npm, and then you can try this code in your webpack configuration. Good luck.
module: {
loaders: [
{ test: require.resolve("jquery"), loader: "expose?$!expose?jQuery" },
]
}
It's probably more sensible to use the ProvidePlugin
new webpack.ProvidePlugin({
'jQuery': 'jquery',
'$': 'jquery',
})
@diega, what about for slimscroll? Do you have the webpack version of that?
@tylerjgarland Could you elaborate your meaning? With that ProvidePlugin
you should be able to use slimscroll as a normal dependency
Sorry for being unclear. I have my jQuery defined and working in webpack but I'm not sure how to include slimscroll in webpack. If you are saying include it as a normal script tag I can do that as well. I was just curious if there's a way to configure it via webpack.
On Mon, Mar 27, 2017, 11:09 PM Timo Sand [email protected] wrote:
@tylerjgarland https://github.com/tylerjgarland Could you elaborate your meaning? With that ProvidePlugin you should be able to use slimscroll as a normal dependency
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rochal/jQuery-slimScroll/issues/268#issuecomment-289673041, or mute the thread https://github.com/notifications/unsubscribe-auth/ABO2MuGYn4fMM3lGbBpXujVgWHjifuOKks5rqKQrgaJpZM4Kg2mh .
The application I was working on simply used import slimscroll from 'slimScroll'
in the JS script which handled the initialization
Alright, thanks for your time.
On Mon, Mar 27, 2017, 11:29 PM Timo Sand [email protected] wrote:
The application I was working on simply used import slimscroll from 'slimScroll' in the JS script which handled the initialization
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rochal/jQuery-slimScroll/issues/268#issuecomment-289676158, or mute the thread https://github.com/notifications/unsubscribe-auth/ABO2MixLaGLAGHNlSZB718Njxi8sGtlzks5rqKjhgaJpZM4Kg2mh .
The reason that it doesn't support Webpack is that it has jquery under "Dependencies", and it should be "PeerDependencies". Webpack then instantiate a new jquery object just for jQuery-slimScroll. The jquery of our project ends with no .slimscroll function. Please update package.json! It requires a major version bump, because it forces projects that uses jQuery-slimScroll to have jquery dependencie declared on package.json. @rochal , can you do it for us? By the way, thanks for slimScroll! =)
I made a pull request: #320