NextJS crashes when importing a re-exported action in use server
file
#54229
Labels
bug
Issue was opened via the bug report template.
linear: next
Confirmed issue that is tracked by the Next.js team.
locked
Verify 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
npm install
npm dev
You will see this:
Now, either:
"use server"
comment from the top ofnextjs-app/src/dist/USE_SERVER_BUNDLE-705b463c.mjs
, and it will work.export const a =
. This shows a new issueDescribe the Bug
NextJS is unable to find an import that exists in a file if that file has a
"use server"
banner. It says:even though
a
is clearly exported by that file.NOTE: the files in
src
result from bundling a library usingvite
/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
The text was updated successfully, but these errors were encountered: