dumi
dumi copied to clipboard
fix: modify the codesandbox default template and import react
🤔 这个变动的性质是?/ What is the nature of this change?
- [ ] 新特性提交 / New feature
- [x] 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
暂无相关issue,操作步骤。
- 版本小于 1.1.47
- 引入代码块 如果为 .tsx 文件 codesandbox 会识别为 Angular 并且无法加载 .less 样式(看图1图2)
- injectReact 方法会给传入文件无论是tsx 还是jsx 还是 less,css都会加上 import React from 'react'; (看图3图4)




💡 需求背景和解决方案 / Background or solution
解决方案:
- 取消自动导入react包,我认为这是多此一举的操作,用户应该保证它的代码别人复制是可以直接使用。
- 将 codesandbox 模版设置为 create-react-app
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
Name | Status | Preview | Updated |
---|---|---|---|
dumi | ⬜️ Ignored (Inspect) | Aug 11, 2022 at 8:15AM (UTC) |
⚡️ Deploying PR Preview...

⚡️ Deploying PR Mobile Preview...

如果引用 antd 的 less,就会一直加载中,而其他的 less 就可以(比如 dumi 的)
@import "~antd/dist/antd.less" ❎
@import "dumi-theme-default/es/builtins/Alert.less" ✅
问了一圈,很有可能是 less loader 没有开启 javascriptEnabled
所以目前来看,pro components 还用不了 CRA 的模板.. 只能等 cssinjs 上了才能用
先合并 #1206 做最小改动了,感谢贡献