Skip to content

Replace Parcel with Vite for frontend builds - #4240

Merged
Mpdreamz merged 4 commits into
fix/speed-up-preview-cifrom
fix/slow-docs-preview
Oct 1, 2026
Merged

Mpdreamz merged 4 commits into
fix/speed-up-preview-cifrom
fix/slow-docs-preview

Conversation

@Mpdreamz

@Mpdreamz Mpdreamz commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

The frontend toolchain moves from Parcel to Vite 8.x. This eliminates the Windows TEMP workaround Parcel required, adds node_modules caching to the bootstrap action, and fixes a class of MSBuild false-positive errors caused by Vite chunk names that contain Error and Warning (EUI icon names).

Affects: Site UI, Automation

Why

Parcel required a Windows-specific workaround (redirecting TEMP to the same drive) and had no incremental-build hooks, so every dotnet build triggered a full npm run build. Vite supports --watch mode, produces stable named outputs (enabling MSBuild up-to-date detection), and avoids the Windows path issue entirely.

What

Vite migration

vite.config.ts replaces .parcelrc and .postcssrc. SkipNpmBuild and DesignTimeBuild MSBuild hooks prevent redundant npm runs in IDE and --no-build scenarios. IgnoreStandardErrorWarningFormat on the npm run build exec prevents MSBuild from misclassifying Vite chunk names (EuiIconWarning, EuiIconError) as build diagnostics.

Vite ships at 8.3.1, @vitejs/plugin-react at 6.1.1, and vite-plugin-svgr at 5.2.0 — the latest available versions at the time of writing.

Node modules caching

The bootstrap action now caches src/Elastic.Documentation.Site/node_modules keyed on package-lock.json and .nvmrc. This eliminates the cold npm ci cost on every CI run.

Incremental build guard

CleanGeneratedStaticAssets no longer deletes the stable named outputs (main.js, styles.css, etc.) that MSBuild uses for up-to-date detection, so npm run build is skipped when no source files have changed.

Verify

cd src/Elastic.Documentation.Site && npm run build && npm run test
dotnet build src/tooling/docs-builder

Stacked on #4206 (NuGet cache fix and NUGET_PACKAGES env var in bootstrap action).

Supersedes #4205.

🤖 Generated with Claude Code

@Mpdreamz
Mpdreamz requested a review from a team as a code owner September 29, 2026 10:08
@Mpdreamz
Mpdreamz requested a review from technige September 29, 2026 10:08

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved: no actionable issues found.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

@Mpdreamz
Mpdreamz force-pushed the fix/speed-up-preview-ci branch from 100eb5b to 60b9946 Compare September 29, 2026 11:50
Mpdreamz and others added 3 commits September 29, 2026 13:50
Vite eliminates the Windows TEMP workaround Parcel required and cuts
cold npm ci cost by caching node_modules in the bootstrap action.
SkipNpmBuild and DesignTimeBuild MSBuild hooks prevent redundant npm
runs in IDE and --no-build scenarios. IgnoreStandardErrorWarningFormat
on the npm run build exec prevents MSBuild from misclassifying Vite
chunk names (EuiIconWarning, EuiIconError) as build diagnostics.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…in SkipNpmBuild guard

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Removes main.js, styles.css, assembler.css, isolated.css, codex.css and their
map files from the pre-build clean target. Deleting declared NpmRunBuild outputs
before the incremental output check defeats MSBuild's up-to-date detection, so
npm run build ran on every dotnet build even when no source files changed.

The clean target now only removes content-hashed chunk-* and asset-* files from
prior Vite runs, which do need cleaning to avoid accumulation across builds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bumps `vite` from 6.3 to 8.3.1, `@vitejs/plugin-react` from 5.1 to
6.1.1, and `vite-plugin-svgr` from 4.3 to 5.2.0. Build and all 321
Jest tests pass unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: please make the new node_modules cache key architecture-aware to prevent cross-arch cache restores from breaking Vite native dependencies in CI/release.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

- uses: actions/cache@v6
with:
path: src/Elastic.Documentation.Site/node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('src/Elastic.Documentation.Site/package-lock.json', '.nvmrc') }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] node_modules cache key should include runner architecture

The new cache key only scopes by runner.os, but this repository runs release builds on both macos-latest and macos-latest-large. Those can differ by CPU architecture, and node_modules can contain arch-specific native binaries (for example esbuild/rollup optional packages used by Vite).

That means an arm64 cache can be restored on x64 (or vice versa), causing intermittent frontend build failures when native modules are loaded.

Suggested change
key: node-modules-${{ runner.os }}-${{ hashFiles('src/Elastic.Documentation.Site/package-lock.json', '.nvmrc') }}
key: node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('src/Elastic.Documentation.Site/package-lock.json', '.nvmrc') }}

@Mpdreamz
Mpdreamz merged commit e287e2b into fix/speed-up-preview-ci Oct 1, 2026
32 checks passed
@Mpdreamz
Mpdreamz deleted the fix/slow-docs-preview branch October 1, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants