-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: livedemo disabled when config babel-plugin-import (#2195)
* fix: livedemo disabled when config babel-plugin-import * docs: guide to faq * docs: simple faq
- Loading branch information
1 parent
d1be4a4
commit fdc233d
Showing
5 changed files
with
57 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
); | ||
} | ||
return disableFlag; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters