1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.loadEsmModule = exports.ngCompilerCli = void 0;
|
4 | function ngCompilerCli() {
|
5 | return loadEsmModule('@angular/compiler-cli');
|
6 | }
|
7 | exports.ngCompilerCli = ngCompilerCli;
|
8 | /**
|
9 | * Lazily compiled dynamic import loader function.
|
10 | */
|
11 | let load;
|
12 | /**
|
13 | * This uses a dynamic import to load a module which may be ESM.
|
14 | * CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
|
15 | * will currently, unconditionally downlevel dynamic import into a require call.
|
16 | * require calls cannot load ESM code and will result in a runtime error. To workaround
|
17 | * this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
|
18 | * Once TypeScript provides support for keeping the dynamic import this workaround can
|
19 | * be dropped.
|
20 | *
|
21 | * @param modulePath The path of the module to load.
|
22 | * @returns A Promise that resolves to the dynamically imported module.
|
23 | */
|
24 | function loadEsmModule(modulePath) {
|
25 | load !== null && load !== void 0 ? load : (load = new Function('modulePath', `return import(modulePath);`));
|
26 | return load(modulePath);
|
27 | }
|
28 | exports.loadEsmModule = loadEsmModule;
|
29 | //# sourceMappingURL=load-esm.js.map |
\ | No newline at end of file |