Setting alias for ~/ in webpack enables us to use require('~/package.json') (#4468)

This commit is contained in:
Panayot Cankov
2017-06-29 15:38:01 +03:00
committed by GitHub
parent 08b16b3b5a
commit b1432679e6

View File

@ -117,16 +117,16 @@ export function enable(mode: InstrumentationMode = "counters") {
}[mode]; }[mode];
} }
if (!(<any>global).__snapshot) { try {
try { const appConfig = require("~/package.json");
const appConfig = global.require("~/package.json");
if (appConfig && appConfig.profiling) {
if (appConfig && appConfig.profiling) { if (appConfig && appConfig.profiling) {
enable(appConfig.profiling); enable(appConfig.profiling);
} }
} } catch(e1) {
} catch(e) { try {
console.log("Profiling startup failed to figure out defaults from package.json, error: " + e); console.log("Profiling startup failed to figure out defaults from package.json, error: " + e1);
} catch(e2) {
// We can get here if an exception is thrown in the mksnapshot as there is no console there.
} }
} }