mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
fix(hermes): wrap registerOnGlobalContext() in try-catch
This commit is contained in:
@ -15,6 +15,7 @@ interface ExtensionMap {
|
||||
}
|
||||
|
||||
function registerOnGlobalContext(moduleName: string, exportName: string): void {
|
||||
try {
|
||||
Object.defineProperty(global, exportName, {
|
||||
get: function () {
|
||||
// We do not need to cache require() call since it is already cached in the runtime.
|
||||
@ -32,6 +33,9 @@ function registerOnGlobalContext(moduleName: string, exportName: string): void {
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
} catch (_e) {
|
||||
// TODO: On Hermes, some globals are non-configurable and we cannot override them.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user