Skip to content

Commit 18f9b18

Browse files
authored
docs: add troubleshooting tip for @rspress/core/theme-original export errors in migration guide (#2984)
1 parent bf0e42f commit 18f9b18

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

website/docs/en/guide/migration/rspress-v1.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,20 @@ If using the `@theme` alias, add path mapping in `tsconfig.json` for type hints:
163163
}
164164
```
165165

166+
:::tip
167+
168+
If you encounter errors about missing exports from `@theme` or `@rspress/core/theme`, it's likely because you didn't use `@rspress/core/theme-original` when overriding the theme in the theme folder, causing a circular reference:
169+
170+
```txt
171+
× ESModulesLinkingError: export 'SvgWrapper' (imported as 'SvgWrapper') was not found in '@theme' (possible exports: HomeLayout, Layout, Search, Tag, getCustomMDXComponent)
172+
173+
× ESModulesLinkingError: export 'Banner' (imported as 'Banner') was not found in '@rspress/core/theme' (possible exports: HomeLayout, Layout, Search, Tag, getCustomMDXComponent)
174+
```
175+
176+
Make sure to use `@rspress/core/theme-original` in the `theme` folder and correctly export all components.
177+
178+
:::
179+
166180
## [Important] Shiki code highlighting replaces prism
167181

168182
Rspress V2 uses Shiki v3 for code highlighting by default. Prism has been removed.

website/docs/zh/guide/migration/rspress-v1.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,20 @@ import { PackageManagerTabs } from '@theme';
163163
}
164164
```
165165

166+
:::tip
167+
168+
如果你遇到 `@theme``@rspress/core/theme` 缺少导出的报错,大概率是因为 theme 文件夹下覆盖主题时没有使用 `@rspress/core/theme-original`,造成循环引用:
169+
170+
```txt
171+
× ESModulesLinkingError: export 'SvgWrapper' (imported as 'SvgWrapper') was not found in '@theme' (possible exports: HomeLayout, Layout, Search, Tag, getCustomMDXComponent)
172+
173+
× ESModulesLinkingError: export 'Banner' (imported as 'Banner') was not found in '@rspress/core/theme' (possible exports: HomeLayout, Layout, Search, Tag, getCustomMDXComponent)
174+
```
175+
176+
请确保在 `theme` 文件夹中使用 `@rspress/core/theme-original` 并正确导出所有组件。
177+
178+
:::
179+
166180
## [重要] Shiki 代码高亮替代 prism
167181

168182
Rspress V2 默认使用 Shiki v3 进行代码高亮,Prism 已被移除。

0 commit comments

Comments
 (0)