Conversation
clydin
force-pushed
the
cli-esbuild-bundle
branch
2 times, most recently
from
September 18, 2026 19:29
b285291 to
43f2d71
Compare
clydin
marked this pull request as ready for review
September 18, 2026 20:27
There was a problem hiding this comment.
Code Review
This pull request transitions the Angular CLI package to ES modules, introducing bundling via esbuild, updating TypeScript configurations, and replacing CommonJS-specific globals like __dirname with ESM equivalents. It also optimizes asset loading by importing Markdown files directly as modules and adds a custom ESM loader for testing. Feedback on these changes highlights a critical issue where marking the root package as a module will cause CommonJS binaries in bin/ to crash at runtime, and suggests adding a safety depth limit to the recursive default export unwrapping in lib/init.ts to prevent infinite loops.
… esbuild Bundle @angular/cli first-party entry points (`lib/cli/index.js` and `lib/init.js`) into ESM chunks using `aspect_rules_esbuild` targeting Node 22 with external packages, code splitting, and bundle sourcemaps disabled. The package `package.json` is now designated as "type": "module", while `bin/package.json` retains CommonJS to allow the `ng` binary bootstrap to validate older Node.js runtimes. A dedicated ES5/CommonJS `bin/version.js` file is stamped by Bazel during release packaging and exposed through a `#version` package subpath import. This enables `bin/ng.js` to perform runtime compatibility checks safely before dynamic ESM import, while allowing bundled chunks to access stamped versions without runtime file I/O. Inlined markdown assets, including MCP resources and command long descriptions, are bundled directly into output chunks via esbuild's text loader, removing the need for runtime filesystem reads and the CommonJS `require.extensions` loader workaround. Ambient `__dirname`, `__filename`, and `createRequire` usages are replaced with `import.meta.dirname` and `import.meta.url`, with `pathToFileURL` used for Windows dynamic imports. A standalone `index.d.ts` declaration file is provided for programmatic package consumers, and unit tests are updated to execute under native Node.js ESM.
clydin
force-pushed
the
cli-esbuild-bundle
branch
from
September 18, 2026 20:36
43f2d71 to
f3dcb9d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bundle @angular/cli first-party entry points into ESM chunks using aspect_rules_esbuild targeting node22 with external packages. Inlined markdown files are packaged into the output bundle chunks directly using esbuild's text loader, and a lib/package.json marker file is generated to designate the bundled library output as ESM.