next.js
next.js copied to clipboard
Turbopack can't use "export * as Foo" syntax, but webpack can
Link to the code that reproduces this issue
https://github.com/matowang/nextjs-turbopack-2025-12-02
To Reproduce
- Create module with
export * as Foosyntax
// /src/app/module-test.ts
export * as ModuleTest from "./module-test";
export function moduleTest() {
return "moduleTest";
}
- import it
// /src/app/page.tsx
import { ModuleTest } from "./module-test";
export default function Home() {
console.log(ModuleTest.moduleTest());
return (
// ...
)
}
- Build it
pnpm run build
Current vs. Expected behavior
Expected build to work, but the build fails.
❯ pnpm run build
> [email protected] build /Users/matowang/Code/nextjs-turbopack-2025-12-02
> next build
▲ Next.js 16.1.0-canary.10 (Turbopack)
Creating an optimized production build ...
✓ Compiled successfully in 1913.0ms
✓ Finished TypeScript in 1434.7ms
Collecting page data using 7 workers ..Error: Failed to collect configuration for /
at ignore-listed frames {
[cause]: Error: Module 53781 was instantiated because it was required from module 60168, but the module factory is not available.
at instantiateModule (.next/server/chunks/ssr/[turbopack]_runtime.js:711:15)
at getOrInstantiateModuleFromParent (.next/server/chunks/ssr/[turbopack]_runtime.js:742:12)
at Context.esmImport [as i] (.next/server/chunks/ssr/[turbopack]_runtime.js:228:20)
at module evaluation (.next/server/chunks/ssr/[root-of-the-server]__f237040c._.js:3:1124)
at instantiateModule (.next/server/chunks/ssr/[turbopack]_runtime.js:719:9)
at getOrInstantiateModuleFromParent (.next/server/chunks/ssr/[turbopack]_runtime.js:742:12)
at Context.esmImport [as i] (.next/server/chunks/ssr/[turbopack]_runtime.js:228:20)
at module evaluation (.next/server/chunks/ssr/_f2898698._.js:1:59)
at instantiateModule (.next/server/chunks/ssr/[turbopack]_runtime.js:719:9)
at getOrInstantiateModuleFromParent (.next/server/chunks/ssr/[turbopack]_runtime.js:742:12)
}
> Build error occurred
Error: Failed to collect page data for /
at ignore-listed frames {
type: 'Error'
}
ELIFECYCLE Command failed with exit code 1.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8103
Available memory (MB): 16384
Available CPU cores: 8
Binaries:
Node: 22.11.0
npm: 10.9.0
Yarn: N/A
pnpm: 9.15.4
Relevant Packages:
next: 16.1.0-canary.10 // Latest available version is detected (16.1.0-canary.10).
eslint-config-next: N/A
react: 19.2.0
react-dom: 19.2.0
typescript: 5.9.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
I ran pnpm run build both locally and on vercel. They both fail with the same logs.
Using pnpm run build --webpack works as expected.
I think this is the same bug as https://github.com/vercel/next.js/issues/86132 If you compare the unit test I added in https://github.com/vercel/next.js/pull/86131 Still not fixed though, unfortunately