diff --git a/packages/fes-plugin-jest/src/index.js b/packages/fes-plugin-jest/src/index.js index cce830f2..5e88cdb3 100644 --- a/packages/fes-plugin-jest/src/index.js +++ b/packages/fes-plugin-jest/src/index.js @@ -1,4 +1,4 @@ -import { runCLI } from 'jest'; + import assert from 'assert'; import { join } from 'path'; import { existsSync } from 'fs'; @@ -71,6 +71,8 @@ export default function (api) { }, {}); args.debug && logger.log(`config from args: ${JSON.stringify(argsConfig)}`); + // 比较大的库建议使用require,使用时才加载,提升fes命令的效率 + const { runCLI } = require('jest'); // Run jest const result = await runCLI( { diff --git a/packages/fes-preset-built-in/src/plugins/commands/dev/index.js b/packages/fes-preset-built-in/src/plugins/commands/dev/index.js index 1c6342d4..7275508f 100644 --- a/packages/fes-preset-built-in/src/plugins/commands/dev/index.js +++ b/packages/fes-preset-built-in/src/plugins/commands/dev/index.js @@ -1,6 +1,5 @@ -import { Server } from '@umijs/server'; -import { delay } from '@umijs/utils'; import assert from 'assert'; +import { delay } from '@umijs/utils'; import { cleanTmpPathExceptCache, getBundleAndConfigs @@ -171,6 +170,8 @@ export default (api) => { args: {} }); + const { Server } = require('@umijs/server'); + server = new Server({ ...opts, compress: true, diff --git a/packages/fes-preset-built-in/src/plugins/commands/info/index.js b/packages/fes-preset-built-in/src/plugins/commands/info/index.js index ff01b352..a8e84e5e 100644 --- a/packages/fes-preset-built-in/src/plugins/commands/info/index.js +++ b/packages/fes-preset-built-in/src/plugins/commands/info/index.js @@ -1,18 +1,15 @@ - -import envinfo from 'envinfo'; - export default function (api) { api.registerCommand({ command: 'info', description: 'print debugging information about your environment', async fn() { - envinfo.run( + require('envinfo').run( { System: ['OS', 'CPU'], Binaries: ['Node', 'Yarn', 'npm'], Browsers: ['Chrome', 'Edge', 'Firefox', 'Safari'], - npmPackages: '/**/{typescript,*vue*,@webank/*/}', + npmPackages: ['@webank/fes', 'vue', 'vue-router'], npmGlobalPackages: ['@webank/fes'] }, {