From 14d7f6eaada07211cac95b60ff20e28e0f5db0f3 Mon Sep 17 00:00:00 2001 From: winixt Date: Tue, 2 Jan 2024 17:26:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=B3=E9=97=AD=20vite=20=E5=91=8A?= =?UTF-8?q?=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fes-builder-vite/src/index.js | 4 ++++ packages/fes/src/forkedDev.js | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/fes-builder-vite/src/index.js b/packages/fes-builder-vite/src/index.js index e2bf8559..101a2fd4 100644 --- a/packages/fes-builder-vite/src/index.js +++ b/packages/fes-builder-vite/src/index.js @@ -1,4 +1,8 @@ +import process from 'node:process'; + export default function () { + process.env.VITE_CJS_IGNORE_WARNING = 'true'; + return { plugins: [ require.resolve('./registerBuilder'), diff --git a/packages/fes/src/forkedDev.js b/packages/fes/src/forkedDev.js index 9b9360bf..454aae36 100644 --- a/packages/fes/src/forkedDev.js +++ b/packages/fes/src/forkedDev.js @@ -2,19 +2,20 @@ * @copy 该文件代码大部分出自 umi,有需要请参考: * https://github.com/umijs/umi/blob/master/packages/umi/src/forkedDev.ts */ - +import process from 'node:process'; import { chalk, yParser } from '@fesjs/utils'; +import fesPkg from '../package.json'; import { Service } from './serviceWithBuiltIn'; import getCwd from './utils/getCwd'; import getPkg from './utils/getPkg'; -import fesPkg from '../package.json'; import { hackFesInBuild } from './hackFesInBuild'; const args = yParser(process.argv.slice(2)); let closed = false; function onSignal(signal, service) { - if (closed) return; + if (closed) + return; closed = true; // 退出时触发插件中的onExit事件 @@ -48,7 +49,8 @@ function onSignal(signal, service) { process.once('SIGQUIT', () => onSignal('SIGQUIT', service)); // kill(15) default process.once('SIGTERM', () => onSignal('SIGTERM', service)); - } catch (e) { + } + catch (e) { console.error(chalk.red(e.message)); console.error(e.stack); process.exit(1);