Skip to content

Migrate from webpack to vite#36896

Closed
silverwind wants to merge 80 commits intogo-gitea:mainfrom
silverwind:vite
Closed

Migrate from webpack to vite#36896
silverwind wants to merge 80 commits intogo-gitea:mainfrom
silverwind:vite

Conversation

@silverwind
Copy link
Copy Markdown
Member

@silverwind silverwind commented Mar 13, 2026

Replace webpack with Vite 8 as the frontend bundler. Frontend build is around 3-4 times faster than before. Will work on all platforms including riscv64 (via wasm).

iife.js is a classic render-blocking script in <head> (handles web components/early DOM setup). index.js is loaded as a type="module" script in the footer. All other JS chunks are also module scripts (supported in all browsers since 2018).

Entry filenames are content-hashed (e.g. index.C6Z2MRVQ.js) and resolved at runtime via the Vite manifest, eliminating the ?v= cache busting (which was unreliable in some scenarios like vscode dev build).

Fixes: #17793
Docs: https://gitea.com/gitea/docs/pulls/364

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 13, 2026
Replace webpack with Vite 8 (Rolldown) as the frontend bundler.

Key changes:
- Replace webpack.config.ts with vite.config.ts using Rolldown
- Use native ES modules with import maps for cache busting
- Build web components as a separate blocking IIFE bundle to prevent
  flash of unstyled content (same behavior as webpack's blocking script)
- Update all dynamic imports from webpack chunk comments to standard
  dynamic import() syntax
- Replace process.env.TEST with import.meta.env.MODE
- Add vite/client types to tsconfig.json
- Update Monaco error suppression regex for new chunk names
- Rename WEBPACK_* Makefile variables to FRONTEND_*

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@silverwind silverwind marked this pull request as draft March 13, 2026 16:33
Replace query-string cache busting (?v=) with content-hashed entry
filenames for JS and CSS assets. Vite now generates a manifest
(.vite/manifest.json) mapping unhashed to hashed paths. A new Go-side
AssetPath function reads the manifest and resolves paths in templates.

This eliminates the need for the importmap workaround that was required
because chunks imported the entry module without the ?v= query parameter.

- Add modules/public/manifest.go with mtime-based cache invalidation
  so dev mode auto-detects frontend rebuilds
- Add AssetPath template function for hashed path resolution
- Update all templates to use AssetPath instead of ?v=AssetVersion
- Pass sharedWorkerPath via window.config for the SharedWorker URL
- Rename eventsource.sharedworker to sharedworker
- Fix markup_external_test.go for type="module" and hashed paths

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
silverwind and others added 2 commits March 13, 2026 18:07
- Add content hash to webcomponents.js IIFE build and append its
  entry to the Vite manifest
- Use AssetPath for swagger asset paths in openapi.go renderer
- Strip content hash from theme CSS filenames in webtheme.go to
  correctly extract internal theme names
- Remove AssetVersion variable and template function, now fully
  replaced by content-hashed filenames via manifest
- Rename AssetPath to GetAssetPath

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@silverwind silverwind marked this pull request as ready for review March 13, 2026 17:10
silverwind and others added 4 commits March 13, 2026 18:25
- Rename AssetPath to GetAssetPath in template helper and all templates
- Clean up stale webcomponents files before IIFE rebuild
- Add comment clarifying TypeError catch for navigation-during-import

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
`build()` returns an array for IIFE lib builds, so the
`'output' in result` check silently skipped the manifest append.
Handle both array and single-object return types.

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@lafriks
Copy link
Copy Markdown
Member

lafriks commented Mar 13, 2026

But this will break Firefox support?

@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Mar 13, 2026

But this will break Firefox support?

Why should it? I've already tested everything in Firefox.

The only new browser requirement is module scripts which are supported in Firefox since 2018.

The webcomponents directory had both index.ts and
webcomponents-blocking.ts with identical content.
Remove the duplicate and use index.ts as the entry.

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates Gitea’s frontend build pipeline from Webpack to Vite 8, switching to content-hashed asset filenames resolved at runtime via a manifest to improve build performance and cache correctness.

Changes:

  • Replace Webpack configuration/build flow with a new Vite 8 build (including manifest generation and hashed outputs).
  • Update backend + templates to resolve asset filenames via public.GetAssetPath / GetAssetPath instead of ?v={{AssetVersion}}.
  • Adjust frontend entrypoints and dynamic imports for Vite, including a dedicated blocking webcomponents bundle and updated Monaco worker wiring.

Reviewed changes

Copilot reviewed 54 out of 60 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
webpack.config.ts Removed legacy Webpack build configuration.
vite.config.ts Added Vite 8 build config, manifest output, webcomponents IIFE build, and license generation.
package.json Replaced Webpack deps with Vite/Vite Vue plugin and related tooling.
pnpm-lock.yaml Lockfile updates reflecting bundler/tooling migration.
types.d.ts Removed webpack-specific module typing.
tsconfig.json Switched TS global types from webpack/module to vite/client.
eslint.config.ts Dropped globals.webpack for web sources.
Makefile Replaced webpack build/watch targets with Vite equivalents and new outputs.
.gitignore Ignored Vite manifest output directory under public/assets/.vite.
web_src/js/webcomponents/webcomponents-blocking.ts New blocking webcomponents entry used for FOUC avoidance.
web_src/js/vitest.setup.ts Updated unit test window config to remove webpack globals and add shared worker path field.
web_src/js/utils/testhelper.ts Updated “unit test mode” detection for Vite/Vitest.
web_src/js/utils/dom.test.ts Adjusted Vitest expectation API usage.
web_src/js/utils.test.ts Adjusted Vitest expectation API usage.
web_src/js/standalone/swagger.ts Ensured standalone CSS is imported from the entrypoint for Vite bundling.
web_src/js/standalone/external-render-iframe.ts Ensured standalone CSS is imported from the entrypoint for Vite bundling.
web_src/js/standalone/devtest.ts Ensured standalone CSS is imported from the entrypoint for Vite bundling.
web_src/js/render/plugins/pdf-viewer.ts Removed webpack chunk annotations; rely on Vite dynamic import.
web_src/js/render/plugins/3d-viewer.ts Removed webpack chunk annotations; rely on Vite dynamic import.
web_src/js/modules/sortable.ts Removed webpack chunk annotation; keep dynamic import for code-splitting.
web_src/js/modules/monaco.ts New Monaco module that wires Vite ?worker imports and exports Monaco API.
web_src/js/markup/refissue.ts Removed webpack chunk annotation; use Vite dynamic import for Vue component.
web_src/js/markup/mermaid.ts Removed webpack chunk annotations; use Vite dynamic import.
web_src/js/markup/math.ts Switched KaTeX + CSS loading to plain dynamic imports for Vite.
web_src/js/markup/asciicast.ts Switched asciinema player + CSS loading to plain dynamic imports for Vite.
web_src/js/index.ts Moved CSS imports into the JS entry; updated dynamic import error handling.
web_src/js/globals.d.ts Updated window.config shape; added MonacoEnvironment typing and *?worker module declaration.
web_src/js/features/tribute.ts Removed webpack chunk annotation; rely on Vite dynamic import.
web_src/js/features/stopwatch.ts Switched SharedWorker URL construction to use manifest-resolved worker path.
web_src/js/features/notification.ts Switched SharedWorker URL construction to use manifest-resolved worker path.
web_src/js/features/sharedworker.ts Added new SharedWorker implementation for event streaming.
web_src/js/features/repo-issue-pull.ts Removed webpack chunk annotation for Vue component dynamic import.
web_src/js/features/repo-findfile.ts Removed webpack chunk annotation for Vue component dynamic import.
web_src/js/features/recent-commits.ts Removed webpack chunk annotation for Vue component dynamic import.
web_src/js/features/heatmap.ts Removed webpack chunk annotation for Vue component dynamic import.
web_src/js/features/dropzone.ts Switched Dropzone + CSS loading to plain dynamic imports for Vite.
web_src/js/features/contributors.ts Removed webpack chunk annotation for Vue component dynamic import.
web_src/js/features/comp/Cropper.ts Removed webpack chunk annotation; rely on Vite dynamic import.
web_src/js/features/comp/ComboMarkdownEditor.ts Switched EasyMDE + CSS loading to plain dynamic imports for Vite.
web_src/js/features/colorpicker.ts Switched color picker + CSS loading to plain dynamic imports for Vite.
web_src/js/features/codeeditor.ts Updated Monaco import to use the new modules/monaco.ts wrapper.
web_src/js/features/code-frequency.ts Removed webpack chunk annotation for Vue component dynamic import.
web_src/js/features/citation.ts Removed webpack chunk annotations; rely on Vite dynamic imports.
web_src/js/features/captcha.ts Removed webpack chunk annotation; rely on Vite dynamic import.
web_src/js/bootstrap.ts Removed webpack public path setup; adjusted ignore patterns and asset base URL logic.
templates/swagger/ui.tmpl Updated Swagger assets to use GetAssetPath and module script.
templates/status/500.tmpl Updated “minimal template functions” comment to reference GetAssetPath.
templates/shared/combomarkdowneditor.tmpl Converted inline script to module script.
templates/repo/diff/box.tmpl Converted inline script to module script and adjusted file-tree visibility init.
templates/devtest/devtest-header.tmpl Updated devtest CSS link to GetAssetPath.
templates/devtest/devtest-footer.tmpl Updated devtest JS to module script + GetAssetPath.
templates/base/head_style.tmpl Updated core CSS and theme CSS to use GetAssetPath.
templates/base/head_script.tmpl Removed AssetVersion usage; added sharedWorkerPath config; added blocking webcomponents script and module index.js script via GetAssetPath.
modules/templates/helper.go Exposed GetAssetPath to templates (replacing AssetVersion).
modules/setting/server.go Removed AssetVersion from server settings initialization.
modules/public/manifest.go Added Vite manifest loader/cache + GetAssetPath resolver.
modules/public/manifest_test.go Added unit tests for manifest parsing and GetAssetPath fallback behavior.
modules/markup/render.go Updated external render iframe asset URLs to resolve via GetAssetPath and module script.
modules/markup/external/openapi.go Updated OpenAPI renderer to use GetAssetPath-resolved swagger assets and module script.
tests/integration/markup_external_test.go Updated expected HTML to match module script + manifest-resolved asset paths.
services/webtheme/webtheme.go Stripped Vite content hash from theme internal names when loading theme metadata.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

silverwind and others added 3 commits March 13, 2026 19:06
- Add comment explaining ENABLE_SOURCEMAP=reduced backward compatibility
- Add dev-licenses-stub plugin so licenses.txt exists in dev builds

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
The 720h default is too aggressive for non-hashed assets like avatars
and custom files. A targeted long cache for content-hashed manifest
assets can be added separately.

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@github-actions github-actions bot removed the docs-update-needed The document needs to be updated synchronously label Mar 24, 2026
@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Mar 24, 2026

By the way, I can see there is consistency, and likely to cause bugs in the future:

* Before: we have the unifed "index.js", it loads "webcomponents" and all modules, they are in the same scope. Every module is only loaded once, and all modules are in the same scope, share the same variables and states.

* After: iife is in its own scope, index is in its own scope, suppose there is a module X:
  
  * iife keeps an instance X1
  * index keeps an instance X2
  * X1 and X2 are different instances and do not share their variables or states.

A real example is generateElemId (in the widely-used framework module utils/dom.ts): it will generate duplicate IDs in iife and index. (ps: don't try to "fix" generateElemId, it is just a real example, even if you use random number to fix generateElemId, there can still be more similar cases which will cause bugs)

Another real example is visibleInstances in tippy.ts

Yes, can't have shared module-scope variables between iife (classic) and module scripts. Here is a breakdown what is in the IIFE:

Package Raw %
jQuery 161 KB 34.8%
htmx + idiomorph 166 KB 35.8%
tippy.js + @popperjs/core 99 KB 21.3%
web components 23 KB 5.0%
everything else ~14 KB 3.1%

jQuery and HTMX should be eliminated separately and I think I can do something about tippy, will try.

@wxiaoguang
Copy link
Copy Markdown
Contributor

jQuery and HTMX should be eliminated separataly and I think I can do something about tippy, will try.

I believe there should be one entry js like before. All modules should be in it.

  • blocking modules are executed when the script is loaded
  • "ES module" modules will be loaded and executed on dom ready.

Otherwise, even if you fixed "tippy" now, there will be "tippy-2" or "tippy-3" in the future, and doubled imported will cause bugs which are hard to debug or fix.

@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Mar 24, 2026

I believe there should be one entry js like before. All modules should be in it.

We still need the IIFE (classic) + Module split for now because:

  • Only classic scripts can be render-blocking. Module scripts will be able with blocking=render attribute but it's not universally supported yet.
  • Vite's lazy-loading only works with module scripts. It has zero support to lazy-load classic scripts.

@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Mar 24, 2026

Could probably use import() to load the module script from the IIFE but I don't really see much of a benefit. It would be slower because it introduces a waterfall effect of fetch -> exectute -> fetch vs. the current 2 scripts which fetch in parallel.

Remove tippy.js and @popperjs/core dependencies from the iife bundle
by replacing the overflow-menu dropdown with a lightweight custom popup
using absolute positioning, CSS border-triangle arrow, and native
click-outside/keyboard handling. This reduces the iife bundle by ~97 KB
(uncompressed).

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@silverwind
Copy link
Copy Markdown
Member Author

Tippy dependency removed overflow-menu, iife size reduced by 21%:

Package Before After Delta
jquery 161 KB 161 KB
htmx.org + idiomorph 166 KB 166 KB
tippy.js 44 KB -44 KB
@popperjs/core 55 KB -55 KB
web components 23 KB 24 KB +1 KB
throttle-debounce 4 KB 4 KB
other 8 KB 7 KB
Total 452 KB 355 KB -97 KB (-21%)

Move the function out of bootstrap.ts into a side-effect-free module so
the ESM bundle can import it without re-triggering the global error
handler initialization. Fix overflow-menu popup item styling to override
fomantic specificity.

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@silverwind
Copy link
Copy Markdown
Member Author

b7a2b0a should fix all remaining issues:

  • Move showGlobalErrorMessage to separate file to avoid initGlobalErrorHandler being called when bootstrap.ts is imported from module scripts.
  • Update tests and fixed a CSS issue on overflow menu.

@silverwind silverwind marked this pull request as ready for review March 24, 2026 14:10
Extract showGlobalErrorMessage, shouldIgnoreError, and
processWindowErrorEvent into a side-effect-free module. This keeps
bootstrap.ts minimal (just the init guard and side effect) and prevents
the ESM bundle from re-triggering the global error handler.

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Mar 24, 2026

Cleaned up the bootstrap some more in 46f6a7e, so it no longer has exports and no one will be tempted to import functions from it (which would trigger the double registration bug because of the side-effect code). Error-related functions now live in errors.ts.

Also removed the initGlobalErrorHandler function wrapper because it's useless only being called once right after definition.

@silverwind silverwind requested a review from Copilot March 24, 2026 17:12
@silverwind silverwind changed the title Migrate from webpack to Vite 8 Migrate from webpack to vite Mar 24, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Migrates Gitea’s frontend asset pipeline from Webpack to Vite 8, introducing content-hashed asset filenames resolved via a Vite manifest and adjusting how/when browser JS is loaded (blocking IIFE bootstrap + deferred module entrypoints).

Changes:

  • Replace Webpack build configuration with a Vite (Rolldown) build, including a separate IIFE build step and manifest generation.
  • Switch templates/backend renderers to resolve hashed assets via GetAssetPath (manifest-backed) instead of ?v= cache-busting.
  • Refactor frontend bootstrapping (IIFE entry + module entry), update dynamic imports, workers, and related tests/setup.

Reviewed changes

Copilot reviewed 73 out of 79 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
webpack.config.ts Removed Webpack configuration (migration to Vite).
vite.config.ts Adds Vite/Rolldown build config, manifest, IIFE build plugin, license output, CSS filtering.
package.json Swaps Webpack deps for Vite deps and related tooling updates.
Makefile Replaces Webpack build/watch targets with Vite build/watch targets.
tsconfig.json Switches TS ambient types from webpack/module to vite/client.
eslint.config.ts Tightens restricted imports (jquery/htmx) and updates globals for new setup.
types.d.ts Removes webpack license-checker module declaration.
.gitignore Ignores Vite manifest directory under public/assets/.vite.
Dockerfile Updates frontend build comment to be Node ecosystem–focused (not webpack-specific).
Dockerfile.rootless Same as Dockerfile (comment update).
templates/base/head_script.tmpl Removes AssetVersion usage, injects sharedWorkerPath, loads iife.js from manifest.
templates/base/footer.tmpl Loads index.js as a module script via manifest path.
templates/base/head_style.tmpl Updates CSS links to use GetAssetPath (manifest resolved).
templates/swagger/ui.tmpl Updates swagger JS/CSS links to use manifest paths and module script.
templates/devtest/devtest-header.tmpl Uses manifest CSS path and adds jQuery presence check.
templates/devtest/devtest-footer.tmpl Loads devtest JS as module via manifest path.
templates/status/500.tmpl Updates template comment to reflect GetAssetPath instead of AssetVersion.
modules/templates/helper.go Exposes GetAssetPath in templates and removes AssetVersion.
modules/setting/server.go Removes setting.AssetVersion generation/storage.
modules/public/manifest.go Adds manifest parser/reloader and GetAssetPath resolver.
modules/public/manifest_test.go Adds unit tests for manifest parsing and fallback behavior.
services/webtheme/webtheme.go Strips Vite content hash from theme internal names when enumerating themes.
modules/markup/render.go Uses GetAssetPath and module script tag for external-render-iframe assets.
modules/markup/external/openapi.go Uses GetAssetPath and module script tag for swagger assets.
tests/integration/markup_external_test.go Updates expected HTML output to include manifest-based asset paths and module script.
modules/graceful/server_http.go Enables HTTP protocol selection including unencrypted HTTP/2 (h2c).
web_src/js/iife.ts New IIFE entrypoint for render-blocking bootstrap/globals/webcomponents/user-settings.
web_src/js/index.ts Replaces previous domready split; runs init pipeline and htmx error toasts; dispatches index-ready.
web_src/js/index-domready.ts Removed old domready chunk entry.
web_src/js/htmx.ts Removed old initHtmx module; htmx is now configured via globals.ts.
web_src/js/globals.ts Loads global jQuery + htmx + idiomorph and configures htmx globally.
web_src/js/globals.d.ts Updates window.config shape, adds MonacoEnvironment typing, adds *?worker module typing.
web_src/js/bootstrap.ts Moves global error handling to modules/errors.ts and adapts init semantics.
web_src/js/modules/errors.ts New lightweight global error utilities and window error event processing.
web_src/js/modules/errors.test.ts Updates tests to target the new errors.ts module and new ignore patterns.
web_src/js/vitest.setup.ts Updates vitest setup for Vite (polyfills + dynamic import for globals).
web_src/js/utils/testhelper.ts Updates unit-test detection for Vite (MODE === 'test').
web_src/js/utils/dom.test.ts Updates assertion API usage (toThrow vs toThrowError).
web_src/js/utils.test.ts Same assertion API adjustment.
web_src/js/modules/monaco.ts New Monaco wrapper to configure worker loading via Vite ?worker imports.
web_src/js/features/codeeditor.ts Switches Monaco dynamic import to the new wrapper module.
web_src/js/features/sharedworker.ts Adds shared worker entry logic for EventSource multiplexing under Vite output.
web_src/js/features/notification.ts Updates SharedWorker URL construction to use manifest-provided worker path.
web_src/js/features/stopwatch.ts Same SharedWorker URL update for stopwatch updates.
web_src/js/standalone/swagger.ts Inlines CSS import for Vite and uses fetch directly for spec retrieval.
web_src/js/standalone/external-render-iframe.ts Inlines CSS import for Vite.
web_src/js/standalone/devtest.ts Inlines CSS import for Vite.
web_src/js/render/plugins/pdf-viewer.ts Removes webpack chunk naming comment from dynamic import.
web_src/js/render/plugins/3d-viewer.ts Same as pdf-viewer (import comment removal).
web_src/js/modules/sortable.ts Removes webpack chunk naming comment from dynamic import.
web_src/js/features/tribute.ts Removes webpack chunk naming comment from dynamic import.
web_src/js/features/repo-findfile.ts Removes webpack chunk naming comment from Vue dynamic import.
web_src/js/features/recent-commits.ts Same as above (Vue dynamic import).
web_src/js/features/contributors.ts Same as above (Vue dynamic import).
web_src/js/features/heatmap.ts Same as above (Vue dynamic import).
web_src/js/features/repo-issue-pull.ts Same as above (Vue dynamic import).
web_src/js/features/comp/Cropper.ts Removes webpack chunk naming comment from dynamic import.
web_src/js/features/comp/ComboMarkdownEditor.ts Removes webpack chunk naming comments from dynamic imports (JS + CSS).
web_src/js/features/colorpicker.ts Removes webpack chunk naming comments from dynamic imports (JS + CSS).
web_src/js/features/citation.ts Removes webpack chunk naming comments from dynamic imports (multiple packages).
web_src/js/features/dropzone.ts Removes webpack chunk naming comments from dynamic imports (JS + CSS).
web_src/js/features/captcha.ts Removes webpack chunk naming comment from dynamic import.
web_src/js/markup/refissue.ts Removes webpack chunk naming comment from Vue dynamic import.
web_src/js/markup/mermaid.ts Removes webpack chunk naming comments from dynamic imports.
web_src/js/markup/math.ts Removes webpack chunk naming comments from dynamic imports (JS + CSS).
web_src/js/markup/asciicast.ts Removes webpack chunk naming comments from dynamic imports (JS + CSS).
web_src/js/modules/fomantic.ts Removes direct jquery import to rely on global jquery.
web_src/js/modules/fomantic/base.ts Removes direct jquery import to rely on global jquery.
web_src/js/modules/fomantic/dimmer.ts Removes direct jquery import to rely on global jquery.
web_src/js/modules/fomantic/dropdown.ts Removes direct jquery import to rely on global jquery.
web_src/js/modules/fomantic/modal.ts Removes direct jquery import to rely on global jquery.
web_src/js/modules/fomantic/tab.ts Removes direct jquery import to rely on global jquery.
web_src/js/modules/fomantic/transition.ts Removes direct jquery import to rely on global jquery.
web_src/js/features/common-page.ts Updates global error import to new modules/errors.ts.
web_src/js/webcomponents/overflow-menu.ts Replaces tippy-based overflow menu with custom popup (DOM + ARIA + click-outside).
web_src/js/webcomponents/README.md Updates guidance to reference vite.config.ts instead of webpack config.
web_src/css/base.css Adds CSS for the new overflow-menu popup styling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Make manifest test hermetic by setting checkTime to prevent reload
- Add String(err) fallback in error handler to prevent crash on non-Error
  rejections
- Remove duplicate @vitejs/plugin-vue from devDependencies

Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 73 out of 79 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (2)

web_src/js/standalone/swagger.ts:1

  • This now assumes the response is always JSON and successful. If the request returns a non-2xx status (or non-JSON body), res.json() will throw and the UI may fail without a clear message. Consider checking res.ok and throwing a descriptive error (or showing a user-facing message) before parsing JSON.
    web_src/js/webcomponents/overflow-menu.ts:1
  • The Tab handling creates a focus trap inside a non-modal popup menu (Tab never leaves the menu). For menu-button patterns, Tab typically closes the menu and moves focus to the next focusable element. Consider changing the Tab behavior to close the popup (and let the browser continue normal tabbing), keeping Arrow keys for intra-menu navigation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Mar 24, 2026

During development, if I save a file quickly (repeat editing and saving by Ctrl+S), then Vite reports an error:

Very likely a vite bug, I'll try to file it.

So far I was unable to reproduce this and I already had Claude looking into Vite internals with no success at trying to create a minimal reproduction case. What file were you editing? CSS or TS? In any case, it's not a huge issue, the next save will fix it.

tippy.js is no longer in the IIFE bundle, so the define is
unnecessary. Vite handles this automatically for module builds.

Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
@silverwind silverwind closed this Mar 26, 2026
@silverwind silverwind deleted the vite branch March 26, 2026 18:51
@lunny
Copy link
Copy Markdown
Member

lunny commented Mar 26, 2026

Why close this one? I think it's useful.

@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Mar 26, 2026

I was doing a branch cleanup and the branch was accidentially deleted, continue in #37002.

silverwind added a commit that referenced this pull request Mar 29, 2026
Replace webpack with Vite 8 as the frontend bundler. Frontend build is
around 3-4 times faster than before. Will work on all platforms
including riscv64 (via wasm).

`iife.js` is a classic render-blocking script in `<head>` (handles web
components/early DOM setup). `index.js` is loaded as a `type="module"`
script in the footer. All other JS chunks are also module scripts
(supported in all browsers since 2018).

Entry filenames are content-hashed (e.g. `index.C6Z2MRVQ.js`) and
resolved at runtime via the Vite manifest, eliminating the `?v=` cache
busting (which was unreliable in some scenarios like vscode dev build).

Replaces: #36896
Fixes: #17793
Signed-off-by: silverwind <me@silverwind.io>
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Claude (Opus 4.6) <noreply@anthropic.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 1 This PR needs approval from one additional maintainer to be merged. modifies/dependencies modifies/docs modifies/frontend modifies/go Pull requests that update Go code modifies/internal modifies/templates This PR modifies the template files topic/code-linting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider replacing Webpack with Vite

7 participants