From 853bbd29774cde326bb645791472838c9dce9909 Mon Sep 17 00:00:00 2001 From: Panayot Cankov Date: Tue, 6 Jun 2017 18:12:53 +0300 Subject: [PATCH] Can't require non console-log when __snapshot generating (#4325) --- tns-core-modules/profiling/profiling.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tns-core-modules/profiling/profiling.ts b/tns-core-modules/profiling/profiling.ts index 4d9ce7ff5..ed132728f 100644 --- a/tns-core-modules/profiling/profiling.ts +++ b/tns-core-modules/profiling/profiling.ts @@ -115,15 +115,17 @@ export function enable(mode: InstrumentationMode = "counters") { }[mode]; } -try { - const appConfig = global.require("~/package.json"); - if (appConfig && appConfig.profiling) { +if (!(global).__snapshot) { + try { + const appConfig = global.require("~/package.json"); if (appConfig && appConfig.profiling) { - enable(appConfig.profiling); + if (appConfig && appConfig.profiling) { + enable(appConfig.profiling); + } } + } catch(e) { + console.log("Profiling startup failed to figure out defaults from package.json, error: " + e); } -} catch(e) { - console.log("Profiling startup failed to figure out defaults from package.json, error: " + e); } export function disable() {