-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { logger } from '@umijs/utils'; | ||
import { isArray } from '@umijs/utils/compiled/lodash'; | ||
import { IApi } from 'umi'; | ||
export const shouldDisabledLiveDemo = (api: IApi) => { | ||
const extraBabelPlugins = api.userConfig.extraBabelPlugins; | ||
const disableFlag = | ||
isArray(extraBabelPlugins) && | ||
extraBabelPlugins!.some((p: any) => | ||
/^import$|babel-plugin-import/.test(p[0]), | ||
); | ||
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', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 链接加一下锚点 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 嗯, 想的是有中文且 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 应该可以给文本加超链接,其他项目里看到过 |
||
); | ||
} | ||
return disableFlag; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我评论的只是个提纲…语句还是要完善下的,比如
style: false
这个估计没人看得懂,且默认就是 falseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hahaha好的, 下次.