daybrush / moveable

Moveable! Draggable! Resizable! Scalable! Rotatable! Warpable! Pinchable! Groupable! Snappable!
https://daybrush.com/moveable/
MIT License
10.08k stars 618 forks source link

croact-moveable requires croact but does not specify in package.json #937

Open gabor opened 1 year ago

gabor commented 1 year ago

running the croact-moveable package complains that there is a missing dependency.

how to reproduce the problem:

  1. npm init
  2. npm add croact-moveable
  3. run node, and inside run require('croact-moveable') you get this error-message:
    Uncaught Error: Cannot find module 'croact'
    Require stack:
    - .../node_modules/croact-moveable/dist/moveable.cjs.js

(in this case you can workaround it by just installing croact, but if you use yarn for example, which only allows loading code from packages that your package depends on, it becomes a harder problem)

daybrush commented 1 year ago

@gabor

Can you tell me why you are installing croact-moveable yourself?

Although not recommended, if you want to use croact-moveable directly, install croact.

If not, use the following moveable depending on the framework or environment you are using.

gabor commented 1 year ago

@daybrush hi, thanks for the recommendations!

technically speaking i am not installing it alone. i am installing the other parts too, but this is all installed using yarn, and yarn makes sure that a package can only see things that it is supposed to see.

and i think, if the package croact-moveable imports croact, then it should have croact in the list of dependencies, shouldn't it?

daybrush commented 1 year ago

@gabor

Taking react as an example, the react-moveable component uses react as its devDependency.

So I'm using croact as the devDependency for croact-moveable as well.

Also, since croact-moveable is a compatible step component, I didn't set any dependencies.

Instead I'm using croact, croact-moveable from the moveable package.

Instead I would add peerDependencies.