// The one place this module reads `window.__rg`, and the one place that says // something useful when it is not there. // // Every shim beside this file, and `src/core.js`, go through here. That is not // tidiness — it removes an ordering dependency that was genuinely fragile. ES // modules evaluate dependencies in the source order of their import statements, // so "put the friendly check in the file that is imported first" is a guarantee // that survives exactly until someone sorts the imports. Whichever module the // bundler happens to reach first, it reaches `window.__rg` through this. // // A missing global means core did not publish its shared dependencies before // this chunk evaluated: an injection or ordering fault in CORE (MODULE_API.md // §3.1), not a fault in this module. Without this, the first symptom is // "Cannot read properties of undefined (reading 'react')" thrown from a file // called react.js, which reads like the module bundled React wrong — the // opposite of what happened. export function rg() { const shared = window.__rg if (!shared) { throw new Error( '[module-uo] window.__rg is missing — core did not publish its shared dependencies before this ' + 'chunk evaluated. That is an injection or ordering fault in core (MODULE_API.md §3.1), not a ' + 'fault in this module.', ) } return shared } export default rg