Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: default theme lost bug if major version mixed in monorepo #1601

Merged
merged 2 commits into from
Apr 11, 2023

Conversation

PeachScript
Copy link
Member

🤔 这个变动的性质是?/ What is the nature of this change?

  • 新特性提交 / New feature
  • bug 修复 / Fix bug
  • 样式优化 / Style optimization
  • 代码风格优化 / Code style optimization
  • 性能优化 / Performance optimization
  • 构建优化 / Build optimization
  • 网站、文档、Demo 改进 / Website, documentation, demo improvements
  • 重构代码或样式 / Refactor code or style
  • 测试相关 / Test related
  • 其他 / Other

🔗 相关 Issue / Related Issue

#1513

💡 需求背景和解决方案 / Background or solution

修复在 monorepo 中同时使用多个不同主版本的 dumi 时,默认主题可能丢失的 bug。

原因:Umi 的路由组件基于文件路径转换成 ChunkName,dumi 2 为了让 ChunkName 保持干净,在 #1513 里用不解析软连接的形式确保绝对路径层级最少(例如 node_modules/dumi/dist/client/pages/404 而不是 node_modules/.pnpm/[email protected]_xxxx/node_modules/dumi/dist/client/pages/404),算是一种绕过的方式;但当 monorepo 下存在多个 dumi 主版本、提取到顶层的版本有可能是 dumi 1 时,就会导致默认主题解析失败(因为 dumi 1 产物里不存在 theme-default 文件夹),进而导致产物出问题

解法:因为 Umi 不会对 @/ 开头的路由组件做转换,所以改用类似 @/dumi__pages 的 alias 指向真正的 dumi/dist/client/pages,路由表里直接使用 @/dumi__pages/404 以保持路由组件的路径层级足够简洁,进而确保 ChunkName 也是简洁的

📝 更新日志 / Changelog

Language Changelog
🇺🇸 English Fix default theme lost bug if major version mixed in monorepo
🇨🇳 Chinese 修复在 monorepo 中使用不同主版本的 dumi 时默认主题丢失的 bug

@vercel
Copy link

vercel bot commented Apr 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
dumi ✅ Ready (Inspect) Visit Preview Apr 7, 2023 2:01pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant