hunk.code_window:  * @returns A Promise that resolves to the dynamically imported module.
    */
   export function loadEsmModule<T>(modulePath: string | URL): Promise<T> {
     return new Function('modulePath', `return import(modulePath);`)(modulePath) as Promise<T>;
   }
hunk.labels: keep keep keep replace keep
hunk.after_edit:   load ??= new Function('modulePath', `return import(modulePath);`) as Exclude<
       typeof load,
       undefined
     >;
     return load(modulePath);
  
hunk.file_path: packages/angular/cli/src/utilities/load-esm.ts
hunk.type: replace
file: import * as assert from 'assert';
  import { killAllProcesses } from '../../../utils/process';
  import { ngServe } from '../../../utils/project';
  
  export default async function () {
    // TODO(architect): Delete this test. It is now in devkit/build-angular.
  
    const port = await ngServe('--serve-path', 'test/');
  
    return Promise.resolve()
      .then(() => fetch(`http://localhost:${port}/test`, { headers: { 'Accept': 'text/html' } }))
      .then(async (response) => {
        assert.strictEqual(response.status, 200);
        assert.match(await response.text(), /<app-root><\/app-root>/);
      })
      .then(() => fetch(`http://localhost:${port}/test/abc`, { headers: { 'Accept': 'text/html' } }))
      .then(async (response) => {
        assert.strictEqual(response.status, 200);
        assert.match(await response.text(), /<app-root><\/app-root>/);
      })
      .finally(() => killAllProcesses());
  }
  