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

Next.js - Attempted import error: 'webgl-sdf-generator' does not contain a default export #1725

Closed
rgbjoy opened this issue Nov 17, 2023 · 8 comments · Fixed by #1726
Closed
Labels
bug Something isn't working released

Comments

@rgbjoy
Copy link

rgbjoy commented Nov 17, 2023

  • three version: 0.158.1
  • react version: 18.2.0
  • @react-three/fiber version: 8.15.11
  • @react-three/drei version: 9.88.16
  • node version: 20.9.0
  • yarn version: 1.22.21
  • nextjs version: 14.0.3

Relevant code:

Getting this spit at me all of a sudden.

 ⚠ ./node_modules/troika-three-text/dist/troika-three-text.esm.js
Attempted import error: 'webgl-sdf-generator' does not contain a default export (imported as 'createSDFGenerator').

Import trace for requested module:
./node_modules/troika-three-text/dist/troika-three-text.esm.js
./node_modules/@react-three/drei/core/Text.js
./node_modules/@react-three/drei/index.js
./components/background.tsx
./components/siteLayout.tsx

Problem description:

As I'm writing this I found someone just posted vercel/next.js#58557

Maybe a next problem.

@rgbjoy rgbjoy added the bug Something isn't working label Nov 17, 2023
@CodyJasonBennett
Copy link
Member

Is this also an issue if you lazy load Text or your app with Drei with dynamic or React.lazy?

@kilimanjjjaro
Copy link

Hello! I've been having the same issue for a few weeks now, even when I'm not using the Text or Text3d module. In my case, the error pops up when I use the PerformanceMonitor module or certain effects.

Attempted import error: 'webgl-sdf-generator' does not contain a default export (imported as 'createSDFGenerator').

Import trace for requested module:
./node_modules/.pnpm/troika-three-text@0.47.2_three@0.158.0/node_modules/troika-three-text/dist/troika-three-text.esm.js
./node_modules/.pnpm/@react-three+drei@9.88.16_@react-three+fiber@8.15.11_@types+three@0.158.2_react-dom@18.2.0_react@18.2.0_three@0.158.0/node_modules/@react-three/drei/core/Text.js
./node_modules/.pnpm/@react-three+drei@9.88.16_@react-three+fiber@8.15.11_@types+three@0.158.2_react-dom@18.2.0_react@18.2.0_three@0.158.0/node_modules/@react-three/drei/index.js

@CodyJasonBennett
Copy link
Member

Thanks, I'll see if there's a way we can work around this issue from our side.

@CodyJasonBennett CodyJasonBennett changed the title ttempted import error: 'webgl-sdf-generator' does not contain a default export Attempted import error: 'webgl-sdf-generator' does not contain a default export Nov 18, 2023
@CodyJasonBennett
Copy link
Member

I'm not able to reproduce this on latest using pages. Are you using the app directory? I might need to see an example to confirm that a workaround exists.

@CodyJasonBennett CodyJasonBennett changed the title Attempted import error: 'webgl-sdf-generator' does not contain a default export Next.js - Attempted import error: 'webgl-sdf-generator' does not contain a default export Nov 18, 2023
@CodyJasonBennett
Copy link
Member

I merged #1726 which contains a work-around so you can consume Drei, but let me know if this does/doesn't work when using Text and whether you're using the app directory.

Copy link

🎉 This issue has been resolved in version 9.88.17 🎉

The release is available on:

Your semantic-release bot 📦🚀

@CodyJasonBennett
Copy link
Member

See vercel/next.js#58557 (comment), this is an issue with the app directory and will be tracked downstream.

Until then, pin to Next 14.0.1 as per my comment.

@CodyJasonBennett
Copy link
Member

This has been fixed downstream in https://github.com/vercel/next.js/releases/tag/v14.0.4-canary.33. See my above comment for how to proceed on stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants