taye / interact.js

JavaScript drag and drop, resizing and multi-touch gestures with inertia and snapping for modern browsers (and also IE9+)
http://interactjs.io/
MIT License
12.38k stars 785 forks source link

Interact.js Exports an Empty Object (in NodeJS only) #451

Closed machineghost closed 7 years ago

machineghost commented 8 years ago

I am using (and loving) Interact.js v1.2.6. I bring it in to my environment via Webpack/NPM, and that's worked fine on the web.

However, I recently tried to test some code that involved Interact.js using Node.js (bypassing Webpack), and when I did I found something odd:

nodejs
> require('interact.js')
> {}

However, all my other libraries work normally in a Node environment, and ultimately Webpack is serving the NPM version to my (working) web page, so I'm not sure what's going on.

Did anything change recently with how Interact.js exports itself in a Node environment? Or is there any other known issues that can cause require('interact.js') to return {} instead of the Interact function?

taye commented 7 years ago

I think this is related to #399 as require is treating 'interact.js' as the name of a file in the working directory instead of a package name.

taye commented 7 years ago

I've renamed the package to interactjs. I think that should fix things.