Skip to content

feat/vite js build v2 - #13331

Draft
RayBB wants to merge 5 commits into
masterfrom
feat/vite-js-build-v2
Draft

feat/vite js build v2#13331
RayBB wants to merge 5 commits into
masterfrom
feat/vite-js-build-v2

Conversation

@RayBB

@RayBB RayBB commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator
  • feat(js): migrate JS build from webpack to Vite
  • refactor(js): address thermo-nuclear review of the Vite JS build migration
  • refactor(js): emit AGPL license via postBanner/postFooter, drop Vite marker
  • docs(js): correct stale esbuild references to Oxc/LightningCSS
  • refactor(js): replace jQuery shim plugins with explicit imports

Closes #

Technical

Testing

Screenshot

Stakeholders

RayBB and others added 5 commits August 13, 2026 11:20
…ation

Fixes found by the strict code-quality review of the webpack→Vite commit:

- Fix scripts/js-build-parity.sh, which recovered webpack.config.js via
  `git show HEAD:` even though that file was deleted by the same commit.
  It now resolves the most recent ref that still contains the file
  (walking `git log --all --follow`), overridable via WP_GIT_REF.
- Extract duplicated options from vite-js.config.mjs / vite-js-iife.config.mjs
  into vite-js-shared.mjs (commonBuildOptions, parameterized jsBuildMarker).
- Derive VITE_VERSION from the installed vite package instead of a hardcoded
  "keep in sync with package.json" constant.
- Move the transform plugins (jquery $ injection, jquery-ui AMD deps) and the
  chunk-name contract into vite-js-plugins.mjs with new unit tests
  (tests/unit/js/vite-js-plugins.test.js); widen jest's transform regex to
  cover .mjs and add a moduleNameMapper entry for the plugin module.
- Remove the 58 dead webpackChunkName comments left in the JS source
  (chunk names are driven by CHUNK_NAME_MAP, not the comments).
- Fix dangling css-vite-migration.md references in the migration docs and
  update the plan doc's status from "plan only" to executed.
- Add code-quality-review-findings.md tracking the review items.

Verified: parity harness PARITY OK, jest 583/583, eslint clean, make js.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
…marker

The Makefile's post-build shell loop prepended the AGPLv3 LibreJS magnet
comment to every JS file. Both Vite configs now emit the header/footer
themselves via output.postBanner/postFooter (applied after minification, so
the comments survive), with shared constants in vite-js-shared.mjs.

Also drops the "built by Vite" marker entirely (and the jsBuildMarker plugin,
the manual VITE_VERSION constant, and the parity harness's marker check), and
uses rolldownOptions as the canonical Vite 8 option name.

Verified: parity harness PARITY OK, jest 583/583, make js.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Vite 8 (rolldown) lowers syntax with Oxc and minifies JS with its native
Oxc-based minifier; CSS is minified by LightningCSS. esbuild is no longer
installed or used by the project — only remaining trace is vite's optional
peer dependency in the lockfile. Updates comments in vite-js-shared.mjs,
vite-css.config.mjs, index.js, and the migration/README docs.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
The two regex-based source-mutation plugins from the Vite migration are gone,
making all jQuery usage explicit and grep-able:

- injectJqueryGlobals() deleted: an AST-based eslint `no-undef` scan found 31
  source files + 4 test files that genuinely reference unbound `$`/`jQuery`
  (the regexes were also injecting unused imports into 5 files via strings,
  regex literals, and comments). Each now has `import $ from 'jquery';`
  (index.js gets both `$` and `jQuery`), and `$`/`jQuery` were removed from
  eslint globals so unbound usage is a `no-undef` error again.
- jqueryUiAmdDeps() deleted: replaced by four explicit wrapper modules
  (jquery-ui-{tabs,dialog,autocomplete,sortable}.js) that list each widget's
  AMD deps in topological order, preserving per-widget tree-shaking (a single
  explicit module had previously been rejected for forcing a 79 KB shared
  chunk onto every widget page). The 7 importing files use the wrappers, and
  new unit tests pin the wrappers to the installed jquery-ui package so an
  upgrade that changes the AMD graph fails loudly.
- Adds docs/ai/jquery-usage.md, an inventory of the remaining jQuery surface
  (33 source files; 8 use $.ajax, 7 depend on jquery-ui widgets, 6 use
  colorbox) to seed the eventual jQuery removal work.

Verified: js-build-parity PARITY OK, jest 581/581, eslint clean, make js works.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant