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

NextJS crashes when importing a re-exported action in use server file #54229

Closed
1 task done
samijaber opened this issue Aug 18, 2023 · 1 comment · Fixed by #54241
Closed
1 task done

NextJS crashes when importing a re-exported action in use server file #54229

samijaber opened this issue Aug 18, 2023 · 1 comment · Fixed by #54241
Assignees
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team. locked

Comments

@samijaber
Copy link
Contributor

samijaber commented Aug 18, 2023

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 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.13.0
      npm: 8.19.3
      Yarn: 1.22.19
      pnpm: 7.26.2
    Relevant Packages:
      next: 13.4.18-canary.0
      eslint-config-next: 13.4.18
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.6
    Next.js Config:
      output: N/A

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

App Router

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

https://github.com/samijaber/repro-nextjs-bundling-issues/tree/2caedce9eafbb8d5d51ad6faac18dde3a48cf516

To Reproduce

You will see this:

CleanShot 2023-08-18 at 10 33 32@2x

Now, either:

Describe the Bug

NextJS is unable to find an import that exists in a file if that file has a "use server" banner. It says:

Attempted import error: 'a' is not exported from './USE_SERVER_BUNDLE.mjs' (imported as 'e').

even though a is clearly exported by that file.

NOTE: the files in src result from bundling a library using vite/rollup. This is why they don't necessarily look like how a human would write them. My real-case issue is around bundling an npm package for consumption by NextJS, so this is why I am showing the bug occuring in this particular format.

Expected Behavior

The import should succeed.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

NEXT-1533

@samijaber samijaber added the bug Issue was opened via the bug report template. label Aug 18, 2023
@shuding shuding self-assigned this Aug 18, 2023
@shuding shuding added the linear: next Confirmed issue that is tracked by the Next.js team. label Aug 18, 2023
@kodiakhq kodiakhq bot closed this as completed in #54241 Aug 18, 2023
kodiakhq bot pushed a commit that referenced this issue Aug 18, 2023
This fixes the compilation of `export { action as renamed }` syntax. Previously it's compiled as `export var action = ...` and with this fix, it will be `export var renamed = ...`.

Closes #54229.
@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2023

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label Sep 2, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants