leapjs-plugins icon indicating copy to clipboard operation
leapjs-plugins copied to clipboard

ReferenceError on import to node

Open aknoerig opened this issue 8 years ago • 2 comments

When I require leapjs-plugins 0.1.11 inside node, I'm currently getting this error:

.../node_modules/leapjs-plugins/main/playback/leap.playback-0.2.1.js:1835
}( window ));
   ^

ReferenceError: window is not defined
    at Object.<anonymous> (.../node_modules/leapjs-plugins/main/playback/leap.playback-0.2.1.js:1835:4)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (.../node_modules/leapjs-plugins/index.js:5:1)
    at Module._compile (module.js:556:32)

aknoerig avatar Oct 14 '16 14:10 aknoerig

I guess this makes sense because a server doesn't have a notion of a window. So maybe a comment in the docs would help.

And then why is there a node leapjs-plugins package at all?

aknoerig avatar Oct 14 '16 14:10 aknoerig

Sorry for the trouble @aknoerig. That's a good question (maybe there's benefits to people using some browser package managers?), but pretty much all of the plugins in leapjs-plugins were built to address browser interaction issues.

raimo avatar Oct 14 '16 18:10 raimo