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);