Closed Alioth1017 closed 4 months ago
项目增加了openapi插件,使用 alita openapi 命令生成代码时,会报
alita openapi
error - AssertionError [ERR_ASSERTION]: Invalid config keys: locale at Config.validateConfig (D:\codes\xxx\node_modules\.pnpm\@umijs+core@4.1.2\node_modules\@umijs\core\dist\config\config.js:209:31) at Config.getConfig (D:\codes\xxx\node_modules\.pnpm\@umijs+core@4.1.2\node_modules\@umijs\core\dist\config\config.js:67:12) at Service.resolveConfig (D:\codes\xxx\node_modules\.pnpm\@umijs+core@4.1.2\node_modules\@umijs\core\dist\service\service.js:352:55) at Service.run (D:\codes\xxx\node_modules\.pnpm\@umijs+core@4.1.2\node_modules\@umijs\core\dist\service\service.js:276:42) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Service.run2 (D:\codes\xxx\node_modules\.pnpm\umi@4.1.2_@babel+core@7.23.6_@types+node@20.9.0_@types+react@18.2.37_eslint@8.53.0_jest@27.5._4tcnrkls6tzbor7xunpz5hc3ge\node_modules\umi\dist\service\service.js:65:12) at async Object.run (D:\codes\xxx\node_modules\.pnpm\alita@3.3.9_@babel+core@7.23.6_@types+node@20.9.0_@types+react-dom@18.2.15_@types+react@18.2._oszwqajgaveewx52pk7dtroahy\node_modules\alita\dist\cli.js:52:13) { generatedMessage: false, code: 'ERR_ASSERTION', actual: false, expected: true, operator: '==' }
发现问题原因: alita多语言插件加载条件限制了只在内置命令('dev', 'build', 'dev-config', 'preview', 'setup')生效
// packages\plugins\src\max\locale.ts export default (api: AlitaApi) => { if (!['dev', 'build', 'dev-config', 'preview', 'setup'].includes(api.name)) return; api.onStart(() => { logger.info('Using Locale Plugin'); }); localePlugin(api); };
是否可以去除命令的限制?
项目增加了openapi插件,使用
alita openapi
命令生成代码时,会报发现问题原因: alita多语言插件加载条件限制了只在内置命令('dev', 'build', 'dev-config', 'preview', 'setup')生效
是否可以去除命令的限制?