mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
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
14 lines
No EOL
611 B
TypeScript
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; |