angular/packages/compiler-cli/import_meta_url.d.ts
Paul Gschwendtner b1d6fad5e3 refactor(compiler-cli): do not use __filename or __dirname global for ESM compatibility (#43431)
Switches the compiler-cli usage of `__filename` to `import.meta.url`
when ESM bundles are generated. Unfortunately we cannot start using
only `import.meta` yet as we still build and run all code in Angular
in CommonJS module output for devmode tests.

This commit also fixes various instances where a jasmine spy was applied on
a namespace export that will break with ES module (and the interop for
CommonJS output). We fix these spies by using a default import.

PR Close #43431
2021-10-01 18:28:45 +00:00

14 lines
No EOL
611 B
TypeScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// Note: The `__ESM_IMPORT_META_URL__` identifier will be defined as part of bundling.
// We cannot use `import.meta.url` directly as this code currently still runs in CommonJS
// for devmode. This is a solution allowing for both ESModule and CommonJS to run this file.
// TODO(devversion): replace all of this with `import.meta.url` once devmode is using ESM.
declare const __ESM_IMPORT_META_URL__: string;