Skip to content

docs(custom-esbuild): document target.configuration in plugin and indexHtmlTransformer#2192

Open
just-jeb wants to merge 1 commit intomasterfrom
fix/1710-document-target-configuration
Open

docs(custom-esbuild): document target.configuration in plugin and indexHtmlTransformer#2192
just-jeb wants to merge 1 commit intomasterfrom
fix/1710-document-target-configuration

Conversation

@just-jeb
Copy link
Copy Markdown
Owner

What

Documents that target.configuration (the active --configuration flag) is available in both factory plugins and indexHtmlTransformer functions, 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: target param was underdocumented for indexHtmlTransformer.

The feature was already implemented and working — it just wasn't shown in the README examples.

Changes

README

  • Factory plugin example now shows both target.project and target.configuration with inline comments
  • indexHtmlTransformer JS and TS examples now include the target param with usage comments

Integration test (packages/custom-esbuild/tests/integration.js)

  • New test target-options-in-plugin-and-transformer runs ng build -c target-options-test against sanity-esbuild-app
  • Verifies target.configuration ("target-options-test") appears in the JS bundle (via factory plugin define) and in index.html (via indexHtmlTransformer meta tag)
  • Confirmed passing locally

Test fixtures (examples/custom-esbuild/sanity-esbuild-app)

  • esbuild/define-configuration-plugin.js — factory plugin (Pattern 1) that reads target.configuration and injects it as a global define
  • esbuild/configuration-transformer.js — transformer that reads target.configuration and injects a <meta> tag
  • angular.json — new target-options-test configuration wiring both fixtures
  • app.component.ts/html — exposes buildConfiguration in the template (additive, doesn't break existing tests)

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Access configuration flag in custom-esbuild plugin TargetOptions parameter is not there with custom-esbuild

1 participant