(name: string, parent: string)
| 185 | * @returns The module's content, if any, otherwise throws an error. |
| 186 | */ |
| 187 | export function requireModule(name: string, parent: string) { |
| 188 | const moduleId = tryResolve(name, parent); |
| 189 | const dependency = moduleId && System.get(moduleId); |
| 190 | |
| 191 | if (!dependency) { |
| 192 | const error: any = new Error(`Cannot find module '${name}'`); |
| 193 | error.code = 'MODULE_NOT_FOUND'; |
| 194 | throw error; |
| 195 | } |
| 196 | |
| 197 | return dependency; |
| 198 | } |
no test coverage detected