Merged
Conversation
…ain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…/IgniteUI/igniteui-wc-examples into migrate-samples-browser-to-astro
ChronosSF
approved these changes
Mar 24, 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.
Closes #1194
Actions deploy workflow - https://github.com/IgniteUI/igniteui-actions/pull/48
Before merging:
Disable the existing Azure DevOps build/release pipeline for this repo
Merge IgniteUI/igniteui-actions#48 first — it adds the wc-samples-cd workflow that this pipeline dispatches to for staging and production deployments
1. Build system removal
browser/directory (~80 files: webpack config, gulp tasks, karma config, babel config, EJS templates, and the compiled browser app entry point)gulpfile.js,webpack.config.js,tsconfig.prod.json,tsconfig.test.jsonpackage.json(webpack, gulp, karma, babel, and related plugins)2. Configuration
2.1.
tsconfig.jsonastro/tsconfigs/strict; removed manual compiler options that duplicated it2.2.
astro.config.mjs— new Astro + Vite configurationoutput: 'static'— builds todist/as plain HTML + JS assetsbase— configurable viaBASE_PATHenv variable for sub-path deployments (e.g./webcomponents-demos)trailingSlash: 'never'— matches IIS routing behaviourstripSampleInstantiation()Vite plugin — strips the module-levelnew Sample();from every samplesrc/index.tsat build time. Without this, Rollup code-splitting can place shared IgniteUI chunks inside a sample not loaded on the current page, causing that sample's constructor to fire against a missing DOMinlineSampleCss()Vite plugin — converts local CSS/SCSS side-effect imports in sample files to?inline+ dynamic<style>injection. Prevents Rollup from emitting a shared CSS chunk that Vite would preload on every page touching the same shared chunk, leaking styles across unrelated samplesoptimizeDeps.noDiscovery: true+ explicitincludelist — stops esbuild from scanning source files during dev startup (the sample glob in[...slug].astrotriggers CSS parse crashes); pre-bundles alligniteui-*packages explicitly for fast first loadmanualChunks— gives everysamples/**/src/index.tsits own named Rollup chunk (e.g.samples/grids--grid--overview), preventing Rollup from inlining all 800+ samples into one bundle (OOM)scss.loadPaths— exposesnode_modules/to Sass so samples using@use 'igniteui-theming/sass/...'resolve correctly2.3. New
src/files addedsrc/env.d.ts— Astro type references (/// <reference types="astro/client" />)src/utils/samples.ts— build-time utilities:keyToSlug,slugToInfo,buildNavTree,extractSampleHtml,toTitleCase; used by all three pages at build time, never shipped to the browsersrc/layouts/SampleLayout.astro— shared HTML shell for every page: loads fonts, the global stylesheet, the#nav-barsidebar and#router-targetcontent area; manages sidebar visibility via iframe detection andsessionStoragesrc/components/NavSidebar.astro— renders the navigation tree (groups → components → samples) with expand/collapse and search filtersrc/pages/index.astro— home page with hero, live search bar, and component cards gridsrc/pages/[...slug].astro— catch-all dynamic route; generates one static page per sample usinggetStaticPaths(); injects the sample's HTML at build time and loads its JS chunk lazily at runtime3. JS & CSS chunk isolation
With 800+ samples sharing the same IgniteUI libraries, Rollup's code-splitting creates shared chunks that can cause two classes of bugs if not handled:
JS constructor leakage — Rollup picks one sample chunk as the "host" for shared IgniteUI symbols. Any other sample that uses those symbols imports from that host chunk at runtime. If the host chunk contains a module-level
new Sample(), that constructor fires immediately on import — even on pages where that sample's DOM does not exist — causingCannot set properties of nullerrors.Fix:
stripSampleInstantiation()removes the trailingnew ClassName();from everysamples/**/src/index.tsat build time. The[...slug].astroclient script callsnew module.Sample()explicitly after the dynamic import resolves, so instantiation only ever happens on the page that owns that sample's DOM.CSS style leakage — Rollup emits a separate
.cssfile for every CSS import it encounters inside a chunk. Vite's__vite__mapDepsthen preloads those CSS files on every page that transitions through the same shared chunk — causing unrelated sample styles (colours, fonts, layout overrides) to appear on the wrong pages.Fix:
inlineSampleCss()rewrites every local CSS/SCSS side-effect import in sample files fromimport './index.css'toimport __css from './index.css?inline'+ a<style>element injected at runtime. Vite no longer emits a separate CSS chunk for it, so nothing leaks. The style is only added to the DOM when that specific sample's JS module actually runs.3. README
npm install→npm run dev→npm run build→npm run preview)4. Build & Dev Server Performance
npm run dev(cold start, until server ready)npm run build(959 pages)Build breakdown (
npm run build)