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: livedemo disabled when config babel-plugin-import #2195

Merged
merged 3 commits into from
Sep 9, 2024

Conversation

Jinbao1001
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

#2193

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

用户配置按需加载后, babel-plugin-import 会擦除 dumi 注入 livedemo context 的相关 import * as 语句, 导致 context 内的变量未定义

why 禁用 ?

浏览器用户源码编译是不经过 babel-plugin 处理的, 目前也没有必要改变这一现状.
禁用一不会报错, 二不会影响存量用户.

📝 更新日志 / Changelog

Language Changelog
🇺🇸 English livedemo disabled when config babel-plugin-import
🇨🇳 Chinese 配置按需加载后禁用liveDemo

Copy link

vercel bot commented Sep 6, 2024

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

Name Status Preview Comments Updated (UTC)
dumi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 9, 2024 6:06am

src/features/compile/utils.ts Outdated Show resolved Hide resolved
src/features/compile/utils.ts Outdated Show resolved Hide resolved
docs/guide/faq.md Outdated Show resolved Hide resolved
@Jinbao1001 Jinbao1001 merged commit fdc233d into master Sep 9, 2024
9 checks passed
@Jinbao1001 Jinbao1001 deleted the fix/babel-import-plugin branch September 9, 2024 06:08

- 不需要 live demo:忽略警告即可
- 希望开启 live demo:
- style: false 直接去掉插件即可
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我评论的只是个提纲…语句还是要完善下的,比如 style: false 这个估计没人看得懂,且默认就是 false

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hahaha好的, 下次.

);
if (disableFlag) {
logger.warn(
'live demo feature has been automatically disabled since babel-plugin-import be registered, if you want to enable live demo feature, checkout: https://d.umijs.org/guide/faq',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

链接加一下锚点

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯, 想的是有中文且encode后太长了.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该可以给文本加超链接,其他项目里看到过

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.

2 participants