Skip to content

feat: migrate build tooling from 10up-toolkit to Vite+ (POC) - #333

Draft
fabiankaegy wants to merge 2 commits into
trunkfrom
feature/vite-plus
Draft

feat: migrate build tooling from 10up-toolkit to Vite+ (POC)#333
fabiankaegy wants to merge 2 commits into
trunkfrom
feature/vite-plus

Conversation

@fabiankaegy

Copy link
Copy Markdown
Member

What this is

A proof-of-concept migration of the wp-scaffold monorepo's build tooling from 10up-toolkit (webpack) to the Vite+ toolchain (vp) + the new @10up/wp-vite-plugins package.

Opening as a draft for others to easily test — it is not ready to merge. The plugin package is not published to npm yet, so it's consumed here as a committed tarball (see below).

What changed

Both themes (tenup-theme, tenup-block-theme) and the mu-plugin now build through Vite+ instead of 10up-toolkit:

  • Buildvp build (Vite 8 / Rolldown) with a dual script + Script Module pass. Block entries are discovered from block.json, per-core-block styles are emitted to dist/autoenqueue/, and .asset.php dependency sidecars are produced by wpExternals. Each workspace has its own vite.config.ts.
  • Lint / formatvp check (oxfmt + oxlint). CSS stays on stylelint (@10up/stylelint-config); block-theme HTML/JSON are excluded from oxfmt so Gutenberg serializer output isn't reformatted.
  • Typechecktsgo --noEmit (tsconfig moduleResolutionBundler).
  • Testvp test (Vitest).
  • Task running — root scripts fan out via vp run -r (with caching where safe).
  • Pre-commit — husky now runs vp staged (configured in the root vite.config.ts), replacing lint-staged / .lintstagedrc.json / .eslintrc.
  • Externals@wordpress/* packages are installed per workspace; externalization is driven by each package's own wpScript / wpScriptModuleExports metadata rather than a hardcoded list.
  • Dependencies — drops 10up-toolkit, npm-run-all, lint-staged, root prettier; adds vite-plus, @10up/stylelint-config, stylelint + postcss plugins.

@10up/wp-vite-plugins itself bundles the WordPress-specific Vite plugins (wpBlocks, wpBlockStyles, wpCopyAssets, wpExternals, wpScriptIife, wpCleanCssChunks) behind a single wp() composer — see the package README.

How to test

git fetch origin
git checkout feature/vite-plus
npm install            # pulls @10up/wp-vite-plugins from the committed tarball
npm run build          # dual-pass build across all workspaces
npm run watch          # dev/watch mode
npm run check          # oxfmt + oxlint
npm test               # Vitest

Then spin up the site and confirm blocks, editor scripts, frontend assets, and per-block styles enqueue correctly.

Note on the package dependency

@10up/wp-vite-plugins is not yet on npm, so it's vendored as a tarball at packages/10up-wp-vite-plugins-0.1.0-beta.0.tgz and referenced via file: from each workspace. The tarball in this PR is built from the current plugin source. Once the package is published, the file: references should be swapped for the npm version.

Status / open questions

  • Validate full parity with toolkit output (asset handles, manifest, Script Module import map)
  • Confirm CI passes with the new task scripts
  • Decide on publishing @10up/wp-vite-plugins to npm vs. keeping the vendored tarball

🤖 Generated with Claude Code

fabiankaegy and others added 2 commits June 10, 2026 13:41
Replaces webpack-based 10up-toolkit with the Vite+ toolchain (vp) and
@10up/wp-vite-plugins across the monorepo:

- build: vp build (Vite 8 / Rolldown) with a dual script + Script Module
  pass; block entries discovered from block.json, per-core-block styles
  emitted to dist/autoenqueue/, .asset.php sidecars via wpExternals
- lint/format: vp check (oxfmt + oxlint); CSS stays on stylelint with
  @10up/stylelint-config; block-theme HTML/JSON excluded from oxfmt to
  preserve Gutenberg serializer output
- typecheck: tsgo --noEmit (tsconfig moduleResolution updated to Bundler)
- test: vp test (Vitest) with --passWithNoTests
- tasks: root scripts fan out via vp run -r with caching enabled
- pre-commit: husky now runs vp staged (config in root vite.config.ts),
  replacing lint-staged/.lintstagedrc.json and .eslintrc files
- @wordpress/* packages are now installed per workspace; externalization
  is driven by their own wpScript/wpScriptModuleExports metadata
- @10up/wp-vite-plugins consumed from packages/ tarball until published

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@10up/wp-vite-plugins now always includes wpCleanCssChunks (a no-op
without CSS-only entries), so the mu-plugin config no longer needs to
add it manually. Refreshes the packaged tarball.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@pdavies88

Copy link
Copy Markdown
Contributor

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.

2 participants