yomotsu / camera-controls

A camera control for three.js, similar to THREE.OrbitControls yet supports smooth transitions and more features.
https://yomotsu.github.io/camera-controls/
MIT License
1.89k stars 241 forks source link

Invalid "main" entry in v2.8.x #481

Closed AER-Quinten closed 4 months ago

AER-Quinten commented 4 months ago

The package.json sets the main entry to dist/camera-controls.js which was changed into dist/camera-controls.module.js in 89cad76

https://github.com/yomotsu/camera-controls/blob/a8e1ef1780b23707bf7bc22619b43d8b2fd17035/package.json#L6

This causes our project with @react-three/drei to fail during build.

AngyDev commented 4 months ago

I'm having the same issue

jsuhncc3d commented 4 months ago

I'm also having the same issue.

Erwol commented 4 months ago

We also ran into the same issue with @react-three/drei@^9.96.5. As a temporary solution you can add the following resolution to your package.json:

  "resolutions": {
    "camera-controls": "2.7.4"
  }
Erwol commented 4 months ago

*This is most likely related to https://github.com/yomotsu/camera-controls/compare/v2.7.4...v2.8.0#diff-47407fecafdf5f5cd55403c3de457833ddf9b6fab45253c04e1dc4c7cb4495b1L17, from yesterday's [v2.8.0](https://github.com/yomotsu/camera-controls/releases/tag/v2.8.0) changelog:

Drop support for UMD, add module.min.js (89cad76)

yomotsu commented 4 months ago

Very sorry for the problem, and thanks for pointing it out. I fixed it with https://github.com/yomotsu/camera-controls/pull/482 and v2.8.2 has been published.

(Do we still need UMD or CJS as well...?

AER-Quinten commented 4 months ago

(Do we still need UMD or CJS as well...?

Seems like @react-three/drei builds to CJS and tries to import your package using require, which throws a syntax error. My guess is that CJS will be required for drei to work, I don't know if there are any other CJS packages that depend on yours that have the same issue.

w00khyung commented 4 months ago

(Do we still need UMD or CJS as well...?

I'm using @react-three/drei v9.80.3 and getting build errors after the v2.8.2 update. having trouble with the require syntax, and I think need CJS support.

yomotsu commented 4 months ago

Thanks, I added CJS as main in package.json. https://github.com/yomotsu/camera-controls/releases/tag/v2.8.3

Looks good now?

AER-Quinten commented 4 months ago

Looks good now?

Build succeeded. Thanks!

w00khyung commented 4 months ago

Looks good now?

it works good. thanks!