-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Open
Labels
TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.
Description
Link to the code that reproduces this issue
https://github.com/daanboer/next-load-native-module
To Reproduce
- Install dependencies.
pnpm i- Build the
rust-libpackage (needs a working rust installation).
pnpm -C packages/rust-lib build- Try to build the
web-apppackage.
pnpm -C packages/web-app buildThe web-app build process will throw the following error:
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: (void 0) is not a function
at c (.next/server/chunks/ssr/[root-of-the-server]__9aa9e4ec._.js:1:392)
at stringify (<anonymous>) {
digest: '3868626329'
}
Export encountered an error on /page: /, exiting the build.
Current vs. Expected behavior
This is a followup of #71630, which highlights a similar issue when using webpack. As the default bundler switched to turbopack, I ran into this issue instead.
I expect the greet function declared in the rust-lib package to be called successfully. Instead I get the following error at build time:
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: (void 0) is not a function
at c (.next/server/chunks/ssr/[root-of-the-server]__9aa9e4ec._.js:1:392)
at stringify (<anonymous>) {
digest: '3868626329'
}
Export encountered an error on /page: /, exiting the build.
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1-NixOS SMP PREEMPT_DYNAMIC Thu Sep 11 15:21:47 UTC 2025
Available memory (MB): 64179
Available CPU cores: 48
Binaries:
Node: 22.20.0
npm: N/A
Yarn: N/A
pnpm: 10.19.0
Relevant Packages:
next: 16.0.0
eslint-config-next: N/A
react: 19.2.0
react-dom: 19.2.0
typescript: 5.9.3
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local)
Additional context
The native node addon is built using napi. I have added rust-lib to serverExternalPackages, but that does not solve the issue.
Metadata
Metadata
Assignees
Labels
TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.