I have create a custom SPFX webpart and what I'm trying to do is to convert the HTML and JQuery flipbook into SPFx webpart. I've download this plugin and add all the reference. However, when it is loading, it is showing error

enter image description here

Uncaught (in promise) ReferenceError: Hammer is not defined
at p.zoomTouchSupport (wow_book.min.js:211)
at p.zoomSetup (wow_book.min.js:201)
at new p (wow_book.min.js:114)
at HTMLDivElement.<anonymous> (wow_book.min.js:122)
at Function.each (jquery.min.js:2)
at n.fn.init.each (jquery.min.js:2)
at n.fn.init.e.fn.wowBook (wow_book.min.js:122)
at HTMLDocument.<anonymous> (LoadA.js:31)
at i (jquery.min.js:2)
at Object.add [as done] (jquery.min.js:2)

I have put the reference in the webpart.ts as require('wowbook'); and config.json

"wowbook": {
  "path": "./src/webparts/flipBookWebPart/assets/js/wow_book.min.js",
  "globalName": "jQuery",
  "globalDependencies": [

I even have declare in config.json for hammerjs, but no luck

"hammerjs": {
  "path": "./src/webparts/flipBookWebPart/assets/js/hammer.min.js",
  "globalName": "hammerjs"

In previous HTML file, there is no include for any hammerjs. Just wondering what when wrong here.

  • I think we might need more information to assist in diagnosing. I don't see anything wrong with the snippets you've posted, which means the problem must be somewhere else, config, package, component, etc. I know its a pain to post all of your code or put it somewhere where we can all see it, but I just don't think we can see enough of your code yet to find the trouble.
    – willman
    Commented Jan 18, 2020 at 21:48

1 Answer 1


Sample demo to include custom js library in SPFx solution.

var alertify:any=require('../ExternalRef/JS/alertify.min.js');

enter image description here

Call function.

  • I have used this step and it is calling. but i still got the error while trying to load the webpart. the error is coming from the js file. The js file is running fine if I using normal html page.
    – crysis08
    Commented Jan 20, 2020 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.