Repository navigation
Replace Parcel with Vite for frontend builds - #4240
Conversation
There was a problem hiding this comment.
Approved: no actionable issues found.
What is this? | From workflow: PR Review
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
100eb5b to
60b9946
Compare
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>
520f233 to
9584db2
Compare
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>
There was a problem hiding this comment.
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') }} |
There was a problem hiding this comment.
[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.
| 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') }} |
The frontend toolchain moves from Parcel to Vite 8.x. This eliminates the Windows TEMP workaround Parcel required, adds
node_modulescaching to the bootstrap action, and fixes a class of MSBuild false-positive errors caused by Vite chunk names that containErrorandWarning(EUI icon names).Affects: Site UI, Automation
Why
Parcel required a Windows-specific workaround (redirecting
TEMPto the same drive) and had no incremental-build hooks, so everydotnet buildtriggered a fullnpm run build. Vite supports--watchmode, produces stable named outputs (enabling MSBuild up-to-date detection), and avoids the Windows path issue entirely.What
Vite migration
vite.config.tsreplaces.parcelrcand.postcssrc.SkipNpmBuildandDesignTimeBuildMSBuild hooks prevent redundant npm runs in IDE and--no-buildscenarios.IgnoreStandardErrorWarningFormaton 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-reactat6.1.1, andvite-plugin-svgrat5.2.0— the latest available versions at the time of writing.Node modules caching
The bootstrap action now caches
src/Elastic.Documentation.Site/node_moduleskeyed onpackage-lock.jsonand.nvmrc. This eliminates the coldnpm cicost on every CI run.Incremental build guard
CleanGeneratedStaticAssetsno longer deletes the stable named outputs (main.js,styles.css, etc.) that MSBuild uses for up-to-date detection, sonpm run buildis skipped when no source files have changed.Verify
Stacked on #4206 (NuGet cache fix and NUGET_PACKAGES env var in bootstrap action).
Supersedes #4205.
🤖 Generated with Claude Code