mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: can't load module error when app is packaged
due to change in node.js(https://github.com/nodejs/node/issues/17076) internalModuleReadFile has been renamed to internalModuleReadJSON, and in vendor/node/lib/internal/modules/cjs/loader.js it will call internalModuleReadJSON and result in can't read the package.json file.
This commit is contained in:
@@ -590,11 +590,11 @@
|
||||
return files
|
||||
}
|
||||
|
||||
const {internalModuleReadFile} = process.binding('fs')
|
||||
process.binding('fs').internalModuleReadFile = function (p) {
|
||||
const {internalModuleReadJSON} = process.binding('fs')
|
||||
process.binding('fs').internalModuleReadJSON = function (p) {
|
||||
const [isAsar, asarPath, filePath] = splitPath(p)
|
||||
if (!isAsar) {
|
||||
return internalModuleReadFile(p)
|
||||
return internalModuleReadJSON(p)
|
||||
}
|
||||
const archive = getOrCreateArchive(asarPath)
|
||||
if (!archive) {
|
||||
|
||||
Reference in New Issue
Block a user