inuyaksa / jquery.nicescroll

nicescroll plugin for jquery - scrollbars like iphone/ipad
https://nicescroll.areaaperta.com/
3.6k stars 1.67k forks source link

niceScroll with requirejs #811

Open IvanSivak opened 4 years ago

IvanSivak commented 4 years ago

Hi there,

Just encountered this bug:

Mismatched anonymous define() modules

..when using the niceScroll with requirejs. According to requirejs site: https://requirejs.org/docs/errors.html#mismatch this can happen when e.g.:

If you use the loader plugins or anonymous modules (modules that call define() with no string ID) but do not use the RequireJS optimizer to combine files together, this error can occur.

So I changed this line from the beginning of the niceScroll plugin:

define(['jquery'], factory);

into:

define('niceScrollModule', ["jquery"], factory)

..and problem disappeared. Seems to be fixed. But can you please check if it's ok and if my fix won't destroy anything else? I'm sorry for not having code to reproduce. This has been a hot fix for me. Thanks