You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix React 19 server bundle errors by using named imports instead of namespace imports
The issue was that with esModuleInterop: false in tsconfig.json, TypeScript
was compiling `import * as React from 'react'` to `import ReactClient from 'react/index.js'`,
which tried to access a default export that doesn't exist in React.
This caused webpack to fail when bundling the server bundle with errors:
- export 'createContext' was not found in 'react'
- export 'useContext' was not found in 'react'
- export 'Component' was not found in 'react'
The fix is to use named imports directly:
- `import { createContext, useContext, type ReactNode } from 'react'`
- `import { Component, use, type ReactNode } from 'react'`
This generates correct ES module imports that work with React 19's export structure.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
0 commit comments