mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
The `__ESM_IMPORT_META_URL__` trick was used because we used both ESM and CommonJS in this repo. It was an interop needed because `import.meta.url` syntax couldn't be used as it woud have caused syntax errors. We still need to keep the CommonJS/ESM interop in the compiler-cli because g3 relies on the compiler and uses CommonJS. This affects very few places, just in the compiler- so this is acceptable. PR Close #48521
20 lines
600 B
JavaScript
20 lines
600 B
JavaScript
/**
|
|
* @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
|
|
*/
|
|
|
|
module.exports = {
|
|
resolveExtensions : ['.mjs', '.js'],
|
|
// Note: `@bazel/esbuild` has a bug and does not pass-through the format from Starlark.
|
|
format : 'esm',
|
|
banner : {
|
|
// Workaround for: https://github.com/evanw/esbuild/issues/946
|
|
js : `
|
|
import {createRequire as __cjsCompatRequire} from 'module';
|
|
const require = __cjsCompatRequire(import.meta.url);
|
|
`,
|
|
},
|
|
};
|