mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
All other frameworks packages are now using APF v13 and are strict ESM packages. The compiler-cli does not use APF and is currently shipped with its devmode ES5 CommonJS sources. This is problematic as CommonJS cannot simply import from ECMAScript modules (like `@angular/compiler`). To fix this we use a bundler that allows us to ship the compiler-cli as a strict ESM package. Note: An ESM can import from an ESM without any problems. This is what we need hre. Unfortunatley we need a bundler here because converting the compiler-cli to ESM is non-trivial as relative imports would need an explicit `.js` extension. This work can be simplified by using a bundler that avoids relative imports completely. Note: This commit uses code-splitting to create multiple bundle entry-points for `yarn ngc, `yarn ngcc` etc. This commit removed the old `ivy-ngcc` entry-point that just printed an error message (to reduce amount of bundles having to be configured). PR Close #43431
24 lines
895 B
JavaScript
24 lines
895 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
|
|
// We also define `__ESM_IMPORT_META_URL__` because we cannot use `import.meta.url`
|
|
// in our sources yet. The devmode CommonJS output will otherwise break.
|
|
// TODO: Remove this workaround in the future once devmode is ESM as well.
|
|
js: `
|
|
import {createRequire as __cjsCompatRequire} from 'module';
|
|
const require = __cjsCompatRequire(import.meta.url);
|
|
const __ESM_IMPORT_META_URL__ = import.meta.url;
|
|
`,
|
|
},
|
|
};
|