mirror of https://github.com/status-im/metro.git
Support cyclic dependencies in require polyfill
Reviewed By: @martinbigio Differential Revision: D2548506 fb-gh-sync-id: fca534179a5f8fcf407917137cdd71d964f145e5
This commit is contained in:
parent
4a1ae23e4c
commit
f58dabc989
|
@ -50,12 +50,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// We must optimistically mark mod as initialized before running the factory to keep any
|
||||||
|
// require cycles inside the factory from causing an infinite require loop.
|
||||||
|
mod.isInitialized = true;
|
||||||
|
|
||||||
// keep args in sync with with defineModuleCode in
|
// keep args in sync with with defineModuleCode in
|
||||||
// packager/react-packager/src/DependencyResolver/index.js
|
// packager/react-packager/src/DependencyResolver/index.js
|
||||||
mod.factory.call(global, global, require, mod.module, mod.module.exports);
|
mod.factory.call(global, global, require, mod.module, mod.module.exports);
|
||||||
mod.isInitialized = true;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
mod.hasError = true;
|
mod.hasError = true;
|
||||||
|
mod.isInitialized = false;
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue