(moduleName: string)
| 1 | export function requireNativeModule<ModuleType = any>(moduleName: string): ModuleType { |
| 2 | const nativeModule = requireOptionalNativeModule<ModuleType>(moduleName); |
| 3 | if (nativeModule != null) { |
| 4 | return nativeModule; |
| 5 | } |
| 6 | if (typeof window === 'undefined') { |
| 7 | // For SSR, we expect not to have native modules available, but to avoid crashing from SSR resolutions, we return an empty object. |
| 8 | return {} as ModuleType; |
| 9 | } |
| 10 | throw new Error(`Cannot find native module '${moduleName}'`); |
| 11 | } |
| 12 | |
| 13 | export function requireOptionalNativeModule<ModuleType = any>( |
| 14 | moduleName: string |
nothing calls this directly
no test coverage detected
searching dependent graphs…