fix: 关闭 vite 告警

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

View File

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

View File

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