Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing TWEEN causes SyntaxError with ES modules in Next.js project #15

Open
mitchhs12 opened this issue Jun 21, 2023 · 1 comment
Open

Comments

@mitchhs12
Copy link

mitchhs12 commented Jun 21, 2023

Description of the issue:

When using react-force-graph (which relies on three-render-objects) in a Next.js project, a SyntaxError occurs because three-render-objects is attempting to import TWEEN from @tweenjs/tween.js using a named import. However, the @tweenjs/tween.js package does not provide an export named 'Tween', causing the Next.js project to fail during import. This seems to be a compatibility issue with ES modules.

Steps to reproduce:

Create a Next.js project and install react-force-graph via yarn add react-force-graph.
Try to import ForceGraph3D (or any other export) from react-force-graph in a component.
Run the Next.js project.
The project fails to compile, throwing a SyntaxError, stating that the requested module @tweenjs/tween.js does not provide an export named 'Tween'.

Expected result:

The Next.js project compiles successfully, and react-force-graph components can be used without any issues.

Actual result:

The project fails to compile, throwing a SyntaxError due to the import of TWEEN from @tweenjs/tween.js in three-render-objects.

Environment:

Next.js version: (13.2.4)
Node.js version: (16.14.2)
react-force-graph version: (1.43.0)
Operating System: (Ubuntu 20.04.6 LTS)
Additional information:

This issue seems to be due to the way three-render-objects is importing TWEEN from @tweenjs/tween.js. A potential solution could be to update the import style in three-render-objects to match the exports provided by @tweenjs/tween.js.

@vasturiano
Copy link
Owner

vasturiano commented Jun 27, 2023

@Valodax this should now be fixed if you upgrade to the latest version of three-render-objects. The import statements have been adapted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants