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-flight-loader fails to produce valid JS when module has no exports #72358

Closed
kristian240 opened this issue Nov 5, 2024 · 0 comments · Fixed by #72404
Closed

next-flight-loader fails to produce valid JS when module has no exports #72358

kristian240 opened this issue Nov 5, 2024 · 0 comments · Fixed by #72404
Labels
bug Issue was opened via the bug report template. Module Resolution Module resolution (CJS / ESM, module resolving) Webpack Related to Webpack with Next.js.

Comments

@kristian240
Copy link

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/zen-bas-rxwhwt?file=%2Fapp%2Fpage.tsx%3A2%2C1

To Reproduce

  1. Start the dev server
  2. Observe the error - Module parse failed: Unexpected token...

Current vs. Expected behavior

I would expect that next-flight-loader produces JS that is valid

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.9.0
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 8.10.2
Relevant Packages:
  next: 15.0.2 // Latest available version is detected (15.0.2).
  eslint-config-next: N/A
  react: 19.0.0-beta-04b058868c-20240508
  react-dom: 19.0.0-beta-04b058868c-20240508
  typescript: 5.1.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Module Resolution, Webpack

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local)

Additional context

No response

@kristian240 kristian240 added the bug Issue was opened via the bug report template. label Nov 5, 2024
@github-actions github-actions bot added Module Resolution Module resolution (CJS / ESM, module resolving) Webpack Related to Webpack with Next.js. labels Nov 5, 2024
kristian240 added a commit to kristian240/next.js that referenced this issue Nov 5, 2024
unstubbable added a commit that referenced this issue Nov 6, 2024
If an ESM module only includes a `'use client'` directive and no
exports, which is the case for one of the modules that are included in
`@chakra-ui/system` for example, we must not try to add
`registerClientReference` statements for this module. This is a
regression from #71968.

fixes #72358
closes #72359
stipsan pushed a commit to sanity-io/next.js that referenced this issue Nov 6, 2024
If an ESM module only includes a `'use client'` directive and no
exports, which is the case for one of the modules that are included in
`@chakra-ui/system` for example, we must not try to add
`registerClientReference` statements for this module. This is a
regression from vercel#71968.

fixes vercel#72358
closes vercel#72359
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. Module Resolution Module resolution (CJS / ESM, module resolving) Webpack Related to Webpack with Next.js.
Projects
None yet
1 participant