docs(custom-esbuild): document target.configuration in plugin and indexHtmlTransformer#2192
Open
docs(custom-esbuild): document target.configuration in plugin and indexHtmlTransformer#2192
Conversation
…exHtmlTransformer - Add target.configuration to the factory plugin example in README (alongside the existing target.project usage), with inline comments explaining each field - Update indexHtmlTransformer examples (both JS and TS) to include the target param with comments showing target.configuration and target.project - Add integration test 'target-options-in-plugin-and-transformer' that does a real ng build with a factory plugin and indexHtmlTransformer both reading target.configuration, then verifies the value appears in the JS bundle and index.html meta tag — confirming the feature works end-to-end - Add esbuild/define-configuration-plugin.js and esbuild/configuration-transformer.js to sanity-esbuild-app as the test fixtures Closes #1710 Closes #1690
This was referenced Apr 27, 2026
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.
What
Documents that
target.configuration(the active--configurationflag) is available in both factory plugins andindexHtmlTransformerfunctions, and adds a runtime integration test confirming this.Why
Closes #1710 — users could not find docs showing how to access the active build configuration inside a custom esbuild plugin.
Closes #1690 — same gap:
targetparam was underdocumented forindexHtmlTransformer.The feature was already implemented and working — it just wasn't shown in the README examples.
Changes
README
target.projectandtarget.configurationwith inline commentsindexHtmlTransformerJS and TS examples now include thetargetparam with usage commentsIntegration test (
packages/custom-esbuild/tests/integration.js)target-options-in-plugin-and-transformerrunsng build -c target-options-testagainstsanity-esbuild-apptarget.configuration("target-options-test") appears in the JS bundle (via factory plugin define) and inindex.html(viaindexHtmlTransformermeta tag)Test fixtures (
examples/custom-esbuild/sanity-esbuild-app)esbuild/define-configuration-plugin.js— factory plugin (Pattern 1) that readstarget.configurationand injects it as a global defineesbuild/configuration-transformer.js— transformer that readstarget.configurationand injects a<meta>tagangular.json— newtarget-options-testconfiguration wiring both fixturesapp.component.ts/html— exposesbuildConfigurationin the template (additive, doesn't break existing tests)