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

Error: Cannot find module './src/utils/window' #599

Closed ismaxs closed 6 years ago

ismaxs commented 6 years ago

Hello,

I am making use of interactjs through the angularjs module called angular-bootstrap-calendar.

For my compilation constructions I use GULP and I get the following problem when the browserify plugin goes into action in order to build the package of external dependencies:

Error: Can not find module './src/utils/window' from 'E: \ xxx \ xx \ node_modules \ interactjs \ dist'      at E: \ xxx \ xx \ node_modules \ browser-resolve \ node_modules \ resolve \ lib \ async.js: 55: 21      at load (E: \ xxx \ xx \ node_modules \ browser-resolve \ node_modules \ resolve \ lib \ async.js: 69: 43)      at onex (E: \ xxx \ xx \ node_modules \ browser-resolve \ node_modules \ resolve \ lib \ async.js: 92: 31)      at E: \ xxx \ xx \ node_modules \ browser-resolve \ node_modules \ resolve \ lib \ async.js: 22: 47      at FSReqWrap.oncomplete (fs.js: 152: 21)

I can not find the solution to the problem because I am not clear at what point I am doing something wrong. Maybe it's browserify the cause?

ismaxs commented 6 years ago

Deleting the DIST folder resolves the problem.

sly7-7 commented 6 years ago

I have the same with both ember-browserify and interact 1.3.3 I had to downgrade interact to 1.2.9 (where there is only a dist folder). So there may be a problem with browserify AND interact. But I don't know how to dig further.

BTW, The problem with only removing the dist folder, is in the case of automatic build.

sly7-7 commented 6 years ago

@ismaxs Would it be possible to reopen the issue, since I don't think it's resolved.

ismaxs commented 6 years ago

I think the problem happens because the internal dependencies are declared with relative routes as in the files of the src folder.

In my case, deleting the DIST folder solves the problem and browserify continues with the execution normally. I do not need to dig deeper into the problem.

However I do not know if interactjs will work normally, in any case it is an optional dependency in my development brought by another dependency.

builtbylane commented 6 years ago

import interact from 'interactjs/src/index'; will solve your problem.