docs(custom-esbuild): document target.configuration in plugin and indexHtmlTransformer#2192
Open
just-jeb wants to merge 2 commits into
Open
docs(custom-esbuild): document target.configuration in plugin and indexHtmlTransformer#2192just-jeb wants to merge 2 commits into
just-jeb wants to merge 2 commits into
Conversation
This was referenced Apr 27, 2026
just-jeb
commented
May 15, 2026
Owner
Author
just-jeb
left a comment
There was a problem hiding this comment.
How does it actually test that the functionality works? Where's the actual test (except building)? What makes sure that the the config is on HTML?
| "cypress:open": "cypress open", | ||
| "cypress:run": "cypress run" | ||
| "cypress:run": "cypress run", | ||
| "build-target-options": "ng build --configuration target-options-test && node -e \"const fs = require('fs');const dist = 'dist/sanity-esbuild-app/browser';const indexHtml = fs.readFileSync(dist + '/index.html', 'utf8');const jsFiles = fs.readdirSync(dist).filter(f => f.endsWith('.js'));const mainJs = jsFiles.map(f => fs.readFileSync(dist + '/' + f, 'utf8')).join('');if (!indexHtml.includes('content=\\\"target-options-test\\\"')) { console.error('FAIL: indexHtmlTransformer did not inject configuration into index.html'); process.exit(1); }if (!mainJs.includes('target-options-test')) { console.error('FAIL: plugin did not inject buildConfiguration into JS bundle'); process.exit(1); }console.log('PASS: target.configuration is accessible in both plugin and indexHtmlTransformer');\"" |
Owner
Author
There was a problem hiding this comment.
Inlining such a script in package.json is a no go. There's a more elegant solution
2 tasks
…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
afb928e to
a6c3dcb
Compare
The integration test previously inlined a multi-line node -e script in package.json (per Jeb's review on PR #2192). Moves the verification to scripts/verify-target-options.js and calls it from the build-target-options npm script. Restores trailing newlines in package.json and angular.json that were dropped.
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.
PR Checklist
PR Type
What is the current behavior?
The
target.configuration(active--configurationflag) is available in both factory plugins andindexHtmlTransformerfunctions, but this was not shown in the README examples, leaving users unable to discover how to access it.Issue Number: #1710, #1690
What is the new behavior?
target.projectandtarget.configurationusageindexHtmlTransformerJS and TS examples now include thetargetparameter with usage commentstarget-options-in-plugin-and-transformerverifiestarget.configurationis accessible at runtime (via bundle define and<meta>tag in index.html)Does this PR introduce a breaking change?
Other information
The feature was already implemented and working — this PR documents it and adds a runtime test to prevent regression.