jQuery-slimScroll icon indicating copy to clipboard operation
jQuery-slimScroll copied to clipboard

It don't support with weback

Open zhangbg opened this issue 8 years ago • 10 comments

It don't support with weback, just because the variables in the code is global object.

zhangbg avatar Oct 26 '16 07:10 zhangbg

Can you paste your webpack config? It works quite well for me

deiga avatar Dec 10 '16 17:12 deiga

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" },
  ]
}

achmadk avatar Dec 17 '16 15:12 achmadk

It's probably more sensible to use the ProvidePlugin

new webpack.ProvidePlugin({
  'jQuery': 'jquery',
  '$': 'jquery',
})

deiga avatar Dec 19 '16 13:12 deiga

@diega, what about for slimscroll? Do you have the webpack version of that?

ghost avatar Mar 27 '17 22:03 ghost

@tylerjgarland Could you elaborate your meaning? With that ProvidePlugin you should be able to use slimscroll as a normal dependency

deiga avatar Mar 28 '17 06:03 deiga

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 .

ghost avatar Mar 28 '17 06:03 ghost

The application I was working on simply used import slimscroll from 'slimScroll' in the JS script which handled the initialization

deiga avatar Mar 28 '17 06:03 deiga

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 .

ghost avatar Mar 28 '17 06:03 ghost

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! =)

setefocos avatar Aug 07 '20 20:08 setefocos

I made a pull request: #320

setefocos avatar Aug 07 '20 20:08 setefocos