diff --git a/packager/src/ModuleGraph/ModuleGraph.js b/packager/src/ModuleGraph/ModuleGraph.js index cce7ff8a8..ac660b5e7 100644 --- a/packager/src/ModuleGraph/ModuleGraph.js +++ b/packager/src/ModuleGraph/ModuleGraph.js @@ -97,6 +97,6 @@ function* concat(...iterables: Array>): Iterable { function prelude(optimize) { return virtualModule( `var __DEV__=${String(!optimize)},` + - '__BUNDLE_START_TIME__=global.nativePerformanceNow?global.nativePerformanceNow():Date.now();' + '__BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();' ); } diff --git a/packager/src/ModuleGraph/__tests__/ModuleGraph-test.js b/packager/src/ModuleGraph/__tests__/ModuleGraph-test.js index d9a9108a3..bc91a412e 100644 --- a/packager/src/ModuleGraph/__tests__/ModuleGraph-test.js +++ b/packager/src/ModuleGraph/__tests__/ModuleGraph-test.js @@ -29,7 +29,7 @@ describe('build setup', () => { dependencies: [], file: { code: 'var __DEV__=true,__BUNDLE_START_TIME__=' + - 'global.nativePerformanceNow?global.nativePerformanceNow():Date.now();', + 'this.nativePerformanceNow?nativePerformanceNow():Date.now();', path: '', type: 'script', }, @@ -43,7 +43,7 @@ describe('build setup', () => { const [prelude] = result.modules; expect(prelude.file.code) .toEqual('var __DEV__=false,__BUNDLE_START_TIME__=' + - 'global.nativePerformanceNow?global.nativePerformanceNow():Date.now();'); + 'this.nativePerformanceNow?nativePerformanceNow():Date.now();'); done(); }); });