Skip to content

Keep HIDDEN examples reachable by URL in production builds#8629

Merged
mvaligursky merged 1 commit into
mainfrom
mv-examples-hidden-url
Apr 22, 2026
Merged

Keep HIDDEN examples reachable by URL in production builds#8629
mvaligursky merged 1 commit into
mainfrom
mv-examples-hidden-url

Conversation

@mvaligursky
Copy link
Copy Markdown
Contributor

Summary

Examples tagged with // @config HIDDEN were previously excluded from the metadata in production builds (npm run build), which meant they were not built at all and could not be opened via URL. This change makes HIDDEN examples always build, so they remain reachable by URL, while still being hidden from the sidebar in production. Sidebar behavior in development (npm run develop) is unchanged — HIDDEN examples still appear in the sidebar there.

Changes

  • examples/scripts/build-metadata.mjs: Always emit metadata for HIDDEN examples, with a new hidden: boolean flag on each entry. This ensures Rollup's EXAMPLE_TARGETS still builds the iframe bundle / HTML for hidden examples in production.
  • examples/src/app/components/Sidebar.mjs: Skip entries with hidden === true from the sidebar list only when process.env.NODE_ENV !== 'development' (substituted at build time by @rollup/plugin-replace). Preserves current dev-mode visibility.
  • examples/utils/utils.mjs: Update the HIDDEN JSDoc to describe the new behavior.

Behavior

  • npm run develop: HIDDEN examples appear in the sidebar and are reachable by URL (unchanged).
  • npm run build: HIDDEN examples do not appear in the sidebar, but their iframe bundle/HTML is still emitted to dist/iframe/<category>_<example>.html and reachable by direct URL.

HIDDEN examples are now always built and accessible by URL. They are
omitted from the sidebar in production builds (`npm run build`) but
remain listed in the sidebar during development (`npm run develop`).

- build-metadata.mjs: always emit metadata for HIDDEN examples, with a
  new `hidden` boolean flag
- Sidebar.mjs: filter out hidden examples from the sidebar only when
  NODE_ENV is not 'development'
- utils.mjs: update HIDDEN JSDoc to reflect the new behavior
@mvaligursky mvaligursky self-assigned this Apr 22, 2026
@mvaligursky mvaligursky merged commit 5f75db7 into main Apr 22, 2026
8 checks passed
@mvaligursky mvaligursky deleted the mv-examples-hidden-url branch April 22, 2026 09:57
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.

1 participant