Skip to content

Commit d570e58

Browse files
authored
fix: update node inspector import and remove workaround (#11444)
1 parent 51ea8d0 commit d570e58

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/rspack/src/trace/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,22 @@ export class JavaScriptTracer {
3030
// plugin counter for different channel in trace viewer, choose 100 to avoid conflict with known tracks
3131
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: this is a bug of biome which can't analyze cross module usage
3232
private static counter = 10000;
33+
3334
/**
3435
* only first call take effects, subsequent calls will be ignored
3536
* @param layer tracing layer
3637
* @param output tracing output file path
3738
*/
3839
static async initJavaScriptTrace(layer: string, output: string) {
39-
//FIXME: workaround for Node.js 16 crash bug, remove it when drop support for Node.js 16
40-
const { Session } = require("node:inspector");
40+
const { Session } = await import("node:inspector");
4141
this.session = new Session();
4242
this.layer = layer;
4343
this.output = output;
4444
this.events = [];
4545
this.state = "on";
4646
this.startTime = process.hrtime.bigint(); // use microseconds
4747
}
48+
4849
static uuid() {
4950
return this.counter++;
5051
}

0 commit comments

Comments
 (0)