File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -2,17 +2,14 @@ const fs = require('fs');
2
2
const path = require ( 'path' ) ;
3
3
const webpack = require ( 'webpack' ) ;
4
4
const { JSDOM } = require ( 'jsdom' ) ;
5
- // runTests();
5
+
6
6
webpack (
7
7
{
8
8
entry : path . join ( __dirname , 'test-code.js' ) ,
9
9
output : {
10
10
path : __dirname ,
11
11
filename : 'tmp.js' ,
12
12
} ,
13
- // resolve: {
14
- // mainFields: ['main'],
15
- // },
16
13
mode : 'development' ,
17
14
} ,
18
15
( err , stats ) => {
@@ -28,10 +25,12 @@ webpack(
28
25
29
26
if ( stats . hasErrors ( ) ) {
30
27
console . error ( info . errors ) ;
28
+ process . exit ( 1 ) ;
31
29
}
32
30
33
31
if ( stats . hasWarnings ( ) ) {
34
32
console . warn ( info . warnings ) ;
33
+ process . exit ( 1 ) ;
35
34
}
36
35
37
36
runTests ( ) ;
Original file line number Diff line number Diff line change @@ -20,6 +20,16 @@ interface SentryGlobal {
20
20
} ;
21
21
}
22
22
23
+ /**
24
+ * Requires a module which is protected against bundler minification.
25
+ *
26
+ * @param request The module path to resolve
27
+ */
28
+ export function dynamicRequire ( mod : any , request : string ) : any {
29
+ // tslint:disable-next-line: no-unsafe-any
30
+ return mod . require ( request ) ;
31
+ }
32
+
23
33
/**
24
34
* Checks whether we're in the Node.js or Browser environment
25
35
*
@@ -365,8 +375,7 @@ const performanceFallback: CrossPlatformPerformance = {
365
375
export const crossPlatformPerformance : CrossPlatformPerformance = ( ( ) => {
366
376
if ( isNodeEnv ( ) ) {
367
377
try {
368
- const req = require ;
369
- const perfHooks = req ( 'perf_hooks' ) as { performance : CrossPlatformPerformance } ;
378
+ const perfHooks = dynamicRequire ( module , 'perf_hooks' ) as { performance : CrossPlatformPerformance } ;
370
379
return perfHooks . performance ;
371
380
} catch ( _ ) {
372
381
return performanceFallback ;
You can’t perform that action at this time.
0 commit comments