# 错误：动态导入 'X' 失败：模块 'Y' 不包含命名导出 'Z'。

- **ID:** `nextjs/dynamic-import-named-export-not-found`
- **领域:** nextjs
- **类别:** module_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

使用 `next/dynamic` 或 `import()` 的动态导入指定了一个在导入模块中不存在的命名导出（例如 `{ MyComponent }`）。这通常发生在模块导出默认导出但没有该名称的命名导出，或者导出名称拼写错误时。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Next.js 13.5 | active | — | — |
| Next.js 14.0 | active | — | — |
| Next.js 14.2 | active | — | — |
| Next.js 15.0 | active | — | — |

## 解决方案

1. ```
   更正命名导出名称以匹配模块中的实际导出。检查模块文件以获得确切的导出名称。
   ```
2. ```
   如果模块导出默认导出，则使用默认导入而不指定命名导出。
   ```
3. ```
   如果模块目前只有默认导出，则向模块添加命名导出。将默认导出重新导出为命名导出。
   ```

## 无效尝试

- **** — The 'use client' directive does not add or change exports. If the named export does not exist, the import still fails. The issue is in the export definition, not the runtime environment. (85% 失败率)
- **** — The error occurs at build time or during module resolution; a try-catch in runtime code does not prevent the initial load failure. The component will not render. (90% 失败率)
- **** — If the module only has a named export, a default import will result in `undefined`. The component will not render correctly, though the error may change. (70% 失败率)
