We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f0e9921 commit d5434c8Copy full SHA for d5434c8
‎src/compiler/performanceCore.ts
@@ -31,11 +31,14 @@ function tryGetPerformance() {
31
if (isNodeLikeSystem()) {
32
try {
33
// By default, only write native events when generating a cpu profile or using the v8 profiler.
34
- const { performance } = require("perf_hooks") as typeof import("perf_hooks");
35
- return {
36
- shouldWriteNativeEvents: false,
37
- performance,
38
- };
+ // Some environments may polyfill this module with an empty object; verify the object has the expected shape.
+ const { performance } = require("perf_hooks") as Partial<typeof import("perf_hooks")>;
+ if (performance) {
+ return {
+ shouldWriteNativeEvents: false,
39
+ performance,
40
+ };
41
+ }
42
}
43
catch {
44
// ignore errors
0 commit comments