I want to use slimscroll for a couple of SPFX webparts but having trouble to get things going.

I used:

npm i jquery-slimscroll
npm i @types/jquery.slimscroll

next to a couple of other modules (jquery etc).

To get things working in the workbench I have to use

import "jquery.slimscroll";

In the config.json I defined:

"jquery.slimscroll": {
  "path": "https://...../jquery.slimscroll.min.js",
  "globalName": "jQuery"

as an external.

So in the workbench this is actually working.

But when bundling gulp bundle --ship, gulp package-solution --ship and moving stuff to SP2016 it does not work. IE11 sometimes shows the WP ok (mostly at first load), Chrome almost never displays things ok.

In the console I have this error:

Uncaught (in promise) TypeError: d(...).slimScroll is not a function

I tried all sorts of things like different import statements. using require in stead off import. But all seem to let the transpiler generate: error TS2339: Property 'slimScroll' does not exist on type 'JQuery'.

Anybody a clue how to properly use jquery.slimscroll in SPFX / typescript?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.