fix: 关闭 vite 告警

This commit is contained in:
winixt 2024-01-02 17:26:02 +08:00
parent 098d175ddf
commit 14d7f6eaad
2 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,8 @@
import process from 'node:process';
export default function () { export default function () {
process.env.VITE_CJS_IGNORE_WARNING = 'true';
return { return {
plugins: [ plugins: [
require.resolve('./registerBuilder'), require.resolve('./registerBuilder'),

View File

@ -2,19 +2,20 @@
* @copy 该文件代码大部分出自 umi有需要请参考 * @copy 该文件代码大部分出自 umi有需要请参考
* https://github.com/umijs/umi/blob/master/packages/umi/src/forkedDev.ts * https://github.com/umijs/umi/blob/master/packages/umi/src/forkedDev.ts
*/ */
import process from 'node:process';
import { chalk, yParser } from '@fesjs/utils'; import { chalk, yParser } from '@fesjs/utils';
import fesPkg from '../package.json';
import { Service } from './serviceWithBuiltIn'; import { Service } from './serviceWithBuiltIn';
import getCwd from './utils/getCwd'; import getCwd from './utils/getCwd';
import getPkg from './utils/getPkg'; import getPkg from './utils/getPkg';
import fesPkg from '../package.json';
import { hackFesInBuild } from './hackFesInBuild'; import { hackFesInBuild } from './hackFesInBuild';
const args = yParser(process.argv.slice(2)); const args = yParser(process.argv.slice(2));
let closed = false; let closed = false;
function onSignal(signal, service) { function onSignal(signal, service) {
if (closed) return; if (closed)
return;
closed = true; closed = true;
// 退出时触发插件中的onExit事件 // 退出时触发插件中的onExit事件
@ -48,7 +49,8 @@ function onSignal(signal, service) {
process.once('SIGQUIT', () => onSignal('SIGQUIT', service)); process.once('SIGQUIT', () => onSignal('SIGQUIT', service));
// kill(15) default // kill(15) default
process.once('SIGTERM', () => onSignal('SIGTERM', service)); process.once('SIGTERM', () => onSignal('SIGTERM', service));
} catch (e) { }
catch (e) {
console.error(chalk.red(e.message)); console.error(chalk.red(e.message));
console.error(e.stack); console.error(e.stack);
process.exit(1); process.exit(1);