Keep HIDDEN examples reachable by URL in production builds#8629
Merged
Conversation
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
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.
Summary
Examples tagged with
// @config HIDDENwere 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 newhidden: booleanflag on each entry. This ensures Rollup'sEXAMPLE_TARGETSstill builds the iframe bundle / HTML for hidden examples in production.examples/src/app/components/Sidebar.mjs: Skip entries withhidden === truefrom the sidebar list only whenprocess.env.NODE_ENV !== 'development'(substituted at build time by@rollup/plugin-replace). Preserves current dev-mode visibility.examples/utils/utils.mjs: Update theHIDDENJSDoc 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 todist/iframe/<category>_<example>.htmland reachable by direct URL.