Skip to content

Commit 73cc6dc

Browse files
committed
fix
1 parent cfbdfef commit 73cc6dc

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

packages/core/src/helpers/exitHook.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { constants } from 'node:os';
2-
import process from 'node:process';
1+
import defer * as os from 'node:os';
2+
import defer * as process from 'node:process';
33

44
type Callback = (exitCode: number) => void;
55

@@ -37,11 +37,11 @@ export function exitHook(onExit: Callback): () => void {
3737
// Use `process.on` instead of `process.once` to disable
3838
// Node.js's default exit behavior
3939
process.on('SIGINT', () => {
40-
exit(constants.signals.SIGINT + 128, 'SIGINT');
40+
exit(os.constants.signals.SIGINT + 128, 'SIGINT');
4141
});
4242
// `kill` command
4343
process.once('SIGTERM', () => {
44-
exit(constants.signals.SIGTERM + 128, 'SIGTERM');
44+
exit(os.constants.signals.SIGTERM + 128, 'SIGTERM');
4545
});
4646
// process.exit or others
4747
process.once('exit', (exitCode) => {

packages/core/src/plugins/fileSize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import fs from 'node:fs';
66
import path from 'node:path';
77
import { promisify } from 'node:util';
8-
import zlib from 'node:zlib';
8+
import defer * as zlib from 'node:zlib';
99
import { JS_REGEX } from '../constants';
1010
import { color } from '../helpers';
1111
import { getAssetsFromStats, type RsbuildAsset } from '../helpers/stats';

packages/core/src/server/gracefulShutdown.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { constants } from 'node:os';
1+
import defer * as os from 'node:os';
22

33
/**
44
* A set to store all cleanup callbacks that should be executed before process termination
@@ -41,7 +41,7 @@ export const setupGracefulShutdown = (): (() => void) => {
4141
// or manually via 'kill -15 <pid>' or 'kill -TERM <pid>' command.
4242
// Add 128 to signal number as per POSIX convention for signal-terminated processes.
4343
const onSigterm = () => {
44-
handleTermination(constants.signals.SIGTERM + 128);
44+
handleTermination(os.constants.signals.SIGTERM + 128);
4545
};
4646
process.once('SIGTERM', onSigterm);
4747

packages/core/src/server/gzipMiddleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ServerResponse } from 'node:http';
2-
import zlib from 'node:zlib';
2+
import defer * as zlib from 'node:zlib';
33
import type { CompressOptions, RequestHandler } from '../types';
44

55
const ENCODING_REGEX = /\bgzip\b/;

0 commit comments

Comments
 (0)