Merge pull request #6354 from electron/package-json-bom

Use require to load package.json
This commit is contained in:
Cheng Zhao 2016-07-06 09:48:37 +09:00 committed by GitHub
commit 6fe4653b54

View file

@ -119,7 +119,7 @@ for (i = 0, len = searchPaths.length; i < len; i++) {
packagePath = searchPaths[i] packagePath = searchPaths[i]
try { try {
packagePath = path.join(process.resourcesPath, packagePath) packagePath = path.join(process.resourcesPath, packagePath)
packageJson = JSON.parse(fs.readFileSync(path.join(packagePath, 'package.json'))) packageJson = require(path.join(packagePath, 'package.json'))
break break
} catch (error) { } catch (error) {
continue continue