Migrate JS build tooling to Vite+ - #502
Open
simon04 wants to merge 8 commits into
Open
Conversation
Replace Jest with `vp test` (Vitest) and pretty-quick/Prettier with `vp fmt` (Oxfmt). Test and format config moves into vite.config.ts, so jest.config.js, .prettierrc and .prettierignore are removed.
Apply Oxfmt formatting across the repo now that Prettier is replaced by `vp fmt`. Also update the README testing docs to reference Vitest.
Introduce a `build` npm script (`webpack --mode production`) and call it from the Makefile instead of invoking webpack directly.
Add a `build:dev` script (`webpack --mode development`) and have the Makefile use it when DEBUG is set, restoring the development-mode build dropped when webpack invocation moved into the build script.
Replace the webpack/babel-loader build with `vp build` (Vite/Rolldown). Each UI page still ships a self-contained classic script, so the two entries are built as separate IIFE bundles (one `vp build` per entry, selected via --mode) into ui/.build/ui/js, matching the previous output that ui/ui.go inlines into a <script> tag. JSX is handled by esbuild's classic runtime targeting the global `React` (loaded via react-*.min.js), so no `react` import is injected and Babel is no longer needed. The two JSX entries are renamed to .jsx; build/test/ format config lives in vite.config.ts. Removes @babel/*, babel-loader, webpack, webpack-cli and webpack-dev-server.
Replace the per-entry --mode invocations with Vite's Environment API: each entry is its own IIFE build environment and builder.buildApp builds them in a single `vp build`. JSX config moves to the oxc.jsx block (Vite 8 uses the Oxc transformer), and build:dev switches to --mode development for the unminified build.
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.
Migrates the UI build and test tooling from webpack/Babel/Jest to Vite+ (Rolldown, Vitest, Oxc, Oxfmt), building both self-contained IIFE bundles in a single
vp buildvia per-entry build environments. Also drops Babel/pretty-quick and wires the new build/test scripts into the Makefile.What kind of change does this PR introduce? (check at least one)
The PR fulfills these requirements:
Other information:
https://viteplus.dev/guide/