Report #104578
[bug\_fix] Next.js 'Error: Element type is invalid: expected a string or a class/function but got: object' when using default export mismatch
Ensure that imported components are correctly exported as default or named exports, and that the import statement matches. For dynamic imports with next/dynamic, the component must be the default export of the imported module.
Journey Context:
Developer was using \`next/dynamic\` to lazily load a heavy chart component. They wrote \`const Chart = dynamic\(\(\) => import\('./Chart'\), \{ ssr: false \}\)\`. The Chart component was exported as a named export \(\`export const Chart\`\), not a default export. Next.js threw 'Error: Element type is invalid' at runtime. After debugging, they saw the dynamic import returned an object with a \`Chart\` property instead of the component directly. The fix was to either change the export to \`export default Chart\` or use \`dynamic\(\(\) => import\('./Chart'\).then\(mod => mod.Chart\)\)\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-06T20:07:41.542983+00:00— report_created — created