Simplebar: How to instantiate 3.1.0

Created on 30 Nov 2018  路  4Comments  路  Source: Grsmto/simplebar

In version 2 I could do this:

````
window.SimpleBar = require('simplebar')

...

new window.SimpleBar(el)
````

But in version 3.1.0 it says that SimpleBar is not a constructor. How come?

Most helpful comment

@EmilMoe, Try this window.SimpleBar = require('simplebar/dist/simplebar');

All 4 comments

Works fine on my side but I'm not using require so not sure. Might be something specific to your environment. What module loader are you using? Is that require.js?

I'm using Webpack (Laravel and Mix). How are you importing it, maybe I can get something from that?

I'm just using ES6 imports, like on the doc/examples.
Could you go on https://codesandbox.io/search?refinementList%5Btemplate%5D%5B0%5D=parcel
and look for an environment similar to yours and provide an example or your issue?
I have been using the plugin with Webpack without issue so that might be something in your environment or something I didn't consider but I have no way to know without a reproductible example.

Thanks!

@EmilMoe, Try this window.SimpleBar = require('simplebar/dist/simplebar');

Was this page helpful?
0 / 5 - 0 ratings

Related issues

artaommahe picture artaommahe  路  6Comments

RennerBink picture RennerBink  路  3Comments

adsim picture adsim  路  5Comments

andrey-evstigneev picture andrey-evstigneev  路  3Comments

Blackleones picture Blackleones  路  3Comments