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

Get "modularize-import-loader" errors when running next 13 with turbo flag #54686

Open
1 task done
dannygooze opened this issue Aug 28, 2023 · 3 comments
Open
1 task done
Labels
bug Issue was opened via the bug report template. Lazy Loading Related to Next.js Lazy Loading (e.g., `next/dynamic` or `React.lazy`).

Comments

@dannygooze
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.14.2
      npm: 9.5.0
      Yarn: 1.22.19
      pnpm: N/A
    Relevant Packages:
      next: 13.4.20-canary.11
      eslint-config-next: 13.4.19
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.2.2
    Next.js Config:
      output: N/A

Which area(s) of Next.js are affected? (leave empty if unsure)

App Router, Dynamic imports (next/dynamic)

Link to the code that reproduces this issue or a replay of the bug

https:github.com/dannygooze/test-turbo-reo

To Reproduce

  1. yarn create next-app --experimental-app
  2. yarn add @headlessui/react
  3. Edit dev script in package.json to be "next dev --turbo"
  4. Add a headlessui component to page.tsx, see repo for example
  5. Run yarn dev
  6. See error in browser

Describe the Bug

When running a next 13 app with turbo, yarn packages are having a hard time resolving due to the way turbo tries to modularize imports. I have tried updating the next config to get this to work and find the correct modules with no luck.

Here is what I have tried adding in my next config:

modularizeImports: { "@headlessui/react": { transform: "@headlessui/react/dist/components/{{kebabCase member}}/{{kebabCase member}}" } }

Expected Behavior

Expect this to run and import the components from yarn packages.

Which browser are you using? (if relevant)

Chrome

How are you deploying your application? (if relevant)

Vercel

@dannygooze dannygooze added the bug Issue was opened via the bug report template. label Aug 28, 2023
@github-actions github-actions bot added the Lazy Loading Related to Next.js Lazy Loading (e.g., `next/dynamic` or `React.lazy`). label Aug 28, 2023
@weyert
Copy link

weyert commented Aug 28, 2023

Looks like it's related to my issue:
#54286

@srs81
Copy link

srs81 commented Sep 5, 2023

Having this exact same error with Next 13 using turbo and @headlessui/react . It looks like this issue in turbo maybe related as well vercel/turbo#4763

@weyert
Copy link

weyert commented Sep 5, 2023

Ain't it already added in the latest version of the canary build? https://github.com/vercel/next.js/blob/canary/packages/next/src/server/config.ts#L674

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Lazy Loading Related to Next.js Lazy Loading (e.g., `next/dynamic` or `React.lazy`).
Projects
None yet
Development

No branches or pull requests

3 participants