From ac2506dd106c1596333d5dd31fcef6bd491deef0 Mon Sep 17 00:00:00 2001 From: javastation <294468242@qq.com> Date: Sun, 13 Jun 2021 10:21:00 +0800 Subject: [PATCH] chore: improve some typedefs --- scripts/jestPerTestSetup.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/jestPerTestSetup.ts b/scripts/jestPerTestSetup.ts index 8255d51ae330cd..d578124341b7ad 100644 --- a/scripts/jestPerTestSetup.ts +++ b/scripts/jestPerTestSetup.ts @@ -7,7 +7,8 @@ import { build, ViteDevServer, UserConfig, - PluginOption + PluginOption, + ResolvedConfig } from 'vite' import { Page } from 'playwright-chromium' // eslint-disable-next-line node/no-extraneous-import @@ -109,15 +110,16 @@ beforeAll(async () => { } else { process.env.VITE_INLINE = 'inline-build' // determine build watch - let isWatch = false + let resolvedConfig: ResolvedConfig const resolvedPlugin: () => PluginOption = () => ({ name: 'vite-plugin-watcher', - configResolved(resolvedConfig) { - isWatch = !!resolvedConfig.build?.watch + configResolved(config) { + resolvedConfig = config } }) options.plugins = [resolvedPlugin()] const rollupOutput = await build(options) + const isWatch = !!resolvedConfig!.build.watch // in build watch,call startStaticServer after the build is complete if (isWatch) { global.watcher = rollupOutput as RollupWatcher