/
githubmirror
/
taro
Обзор
Документация
Войти
/
githubmirror
/
taro
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/taro-cli/src/util/appConfig.ts
29 строк
935 B
yushijie1
feat(cli): 增加按需编译pages或components能力
25 дек 2024, 09:52
25 дек 2024, 09:52
47722ef
Код
Авторство
О чём код?
import { IPluginContext } from '@tarojs/service' import { isString } from '@tarojs/shared' import { AppConfig } from '@tarojs/taro' /** * 按需编译功能,只编译指定的页面或组件 * @param appConfig * @param args */ export function extractCompileEntry( appConfig: AppConfig, args: { _: string[], [key: string]: any }, ctx: IPluginContext ): void { const { chalk } = ctx.helper const extractType = isString(args.pages) ? 'pages' : isString(args.components) ? 'components' : '' if (!extractType) return const entries = args[extractType].split(',').map(item => item.trim()).filter(Boolean) if (!entries.length) { console.log(chalk.yellow(`按需编译开启失败,请指定要编译的${extractType}`)) return } appConfig[extractType] = entries appConfig.subPackages = [] console.log(chalk.green(`已开启按需编译,仅编译以下${extractType}: ${appConfig[extractType]}`)) }