Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It don't support with weback #268

Open
zhangbg opened this issue Oct 26, 2016 · 10 comments
Open

It don't support with weback #268

zhangbg opened this issue Oct 26, 2016 · 10 comments

Comments

@zhangbg
Copy link

zhangbg commented Oct 26, 2016

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

@deiga
Copy link

deiga commented Dec 10, 2016

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

@achmadk
Copy link

achmadk commented Dec 17, 2016

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

@deiga
Copy link

deiga commented Dec 19, 2016

It's probably more sensible to use the ProvidePlugin

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

@ghost
Copy link

ghost commented Mar 27, 2017

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

@deiga
Copy link

deiga commented Mar 28, 2017

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

@ghost
Copy link

ghost commented Mar 28, 2017 via email

@deiga
Copy link

deiga commented Mar 28, 2017

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

@ghost
Copy link

ghost commented Mar 28, 2017 via email

@setefocos
Copy link

setefocos commented Aug 7, 2020

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
Copy link

I made a pull request: #320

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants