| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c574b57 commit ae7789a
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -124,6 +124,16 @@ translators.set('json', async function jsonStrategy(url) { | |||
| 124 | 124 | }); | |
| 125 | 125 | } | |
| 126 | 126 | const content = await readFileAsync(pathname, 'utf-8'); | |
| 127 | + // A require call could have been called on the same file during loading and | ||
| 128 | + // that resolves synchronously. To make sure we always return the identical | ||
| 129 | + // export, we have to check again if the module already exists or not. | ||
| 130 | + module = CJSModule._cache[modulePath]; | ||
| 131 | + if (module && module.loaded) { | ||
| 132 | + const exports = module.exports; | ||
| 133 | + return createDynamicModule(['default'], url, (reflect) => { | ||
| 134 | + reflect.exports.default.set(exports); | ||
| 135 | + }); | ||
| 136 | + } | ||
| 127 | 137 | try { | |
| 128 | 138 | const exports = JsonParse(stripBOM(content)); | |
| 129 | 139 | module = { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments