Skip to content

feat(Build): modernize build and test tooling with Vite/Vitest & oxlint/oxfmt#3435

Merged
finetjul merged 2 commits into
Kitware:masterfrom
daker:vite-vitest-migration
May 21, 2026
Merged

feat(Build): modernize build and test tooling with Vite/Vitest & oxlint/oxfmt#3435
finetjul merged 2 commits into
Kitware:masterfrom
daker:vite-vitest-migration

Conversation

@daker
Copy link
Copy Markdown
Collaborator

@daker daker commented Mar 3, 2026

Context

This PR completes a tooling migration from the legacy webpack/rollup + Karma/Tape setup to a unified Vite + Vitest stack. It updates local development, build output, test execution, and CI integration to run on the new toolchain.

Results

  • Reduce maintenance overhead from multiple legacy build/test systems.
  • Standardize on a modern, faster toolchain for both local and CI workflows.
  • Improve consistency between build and test environments by sharing Vite-based config.
  • Everything should works as before. 🤞
  • UMD vtk.js bundle: −10% raw / −6% gzipped (2.80 MB → 2.53 MB; 701 KB → 659 KB gzipped)

Changes

  • Replaced legacy build configuration with vite.config.js.
  • Added Vitest browser-runner configuration via vitest.config.js.
  • Migrated test infrastructure and tests to Vitest.
  • Removed old webpack, rollup-legacy, and Karma-related configs/plugins/utilities.
  • Migrate ExampleRunner to vite devserver.
  • Updated GitHub Actions workflows to run the Vite/Vitest pipeline.
  • Updated dependencies and lockfile to reflect the new build/test stack.
  • Documentation and TypeScript definitions were updated to match those changes

PR and Code Checklist

  • semantic-release commit messages
  • Run npm run reformat to have correctly formatted code

Testing

  • This change adds or fixes unit tests
  • Tested environment:
    • vtk.js:
    • OS:
    • Browser:

@daker daker force-pushed the vite-vitest-migration branch 29 times, most recently from 65d7ab0 to 825c998 Compare March 5, 2026 12:40
@daker daker marked this pull request as ready for review March 5, 2026 12:51
@PaulHax
Copy link
Copy Markdown
Collaborator

PaulHax commented May 17, 2026

Good progress. I've drafted some additions to this PR: daker#1

I don't think this PR breaks anything, but I think we should make this a major version release due to its risk.

We should squash these commit down before merging.

@daker
Copy link
Copy Markdown
Collaborator Author

daker commented May 17, 2026

@PaulHax left a comment on the PR

@daker
Copy link
Copy Markdown
Collaborator Author

daker commented May 18, 2026

@PaulHax FF test are failing due to no webgl context, i still believe that trace: "retain-on-failure" is needed, maybe it will make Firefox tests passes when Playwright is "watching" either by recording videos or traces.

@daker
Copy link
Copy Markdown
Collaborator Author

daker commented May 18, 2026

@PaulHax try : trace: 'retain-on-failure',

@daker
Copy link
Copy Markdown
Collaborator Author

daker commented May 18, 2026

@PaulHax FF tests failed again 😭 i am not sure if FF WebGL in headless mode is working https://bugzilla.mozilla.org/show_bug.cgi?id=1375585

@PaulHax
Copy link
Copy Markdown
Collaborator

PaulHax commented May 18, 2026

I think we got the FireFox CI issue by getting the config plumming right so it gets a headed browser in 39f2b94

@daker
Copy link
Copy Markdown
Collaborator Author

daker commented May 18, 2026

let's see what @finetjul and @jourdain have to say

@finetjul
Copy link
Copy Markdown
Member

let's see what @finetjul and @jourdain have to say

I leave it to @PaulHax and @jourdain

@jourdain
Copy link
Copy Markdown
Collaborator

What is the question for me?

@daker
Copy link
Copy Markdown
Collaborator Author

daker commented May 19, 2026

@jourdain How to manage the merge? We tried to minimize the breaking changes as much as we can. @PaulHax added some changes in the BREAKING CHANGES file.

@daker daker force-pushed the vite-vitest-migration branch from 9fe3b1f to bec121f Compare May 20, 2026 13:56
@PaulHax
Copy link
Copy Markdown
Collaborator

PaulHax commented May 20, 2026

The built bundle works in https://github.com/Kitware/VolView and https://github.com/kitware/itk-vtk-viewer.

I think this is good to merge once we squash to 1 commit with feat!: use vite, vitest, oxlint, oxfmt commit.

@daker
Copy link
Copy Markdown
Collaborator Author

daker commented May 20, 2026

@PaulHax i am AFK, feel free to do it i can approve on my phone.

@jourdain jourdain self-requested a review May 20, 2026 22:08
Copy link
Copy Markdown
Collaborator

@jourdain jourdain left a comment

Choose a reason for hiding this comment

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

@PaulHax I trust your judgement. Even if we have some breaking change, I'm sure we can work them out. Right now, moving forward on a modern build system is more important for the future of vtk.js

@jourdain
Copy link
Copy Markdown
Collaborator

@PaulHax can you list the breaking changes? I could not guess what they were. Thx

@daker
Copy link
Copy Markdown
Collaborator Author

daker commented May 21, 2026

@jourdain

@PaulHax can you list the breaking changes? I could not guess what they were. Thx

From 35.x to 36

  • vtk-lite.js deprecated. The UMD build previously produced a slimmed-down companion bundle dist/umd/vtk-lite.js (curated ColorMaps subset; PDBReader, MoleculeToRepresentation, MobileVR, and webvr-polyfill stubbed out). The Vite build pipeline no longer produces a distinct lite bundle; vtk-lite.js now ships as a byte-identical alias of vtk.js so existing <script src=…/vtk-lite.js> and CDN consumers continue to load. Consumers should migrate to vtk.js directly — the alias will be removed in a future major. Note that anything that indexed into the ColorMaps array by position will now see the full preset set, not the lite subset.

daker and others added 2 commits May 21, 2026 13:38
Replace the webpack + rollup build, Karma test harness, and
ESLint + Prettier with Vite, Vitest browser mode, oxlint, and oxfmt.

BREAKING CHANGE: build, test, and lint tooling overhauled. See
BREAKING_CHANGES.md for migration notes.

Co-authored-by: Paul Elliott <paul@vizworkshop.com>
BREAKING CHANGE: getStateArrayMapFunc has been removed from macros.
It was a map callback that called getState() on vtkObject items and
passed primitives through unchanged. Inline the equivalent where
needed, e.g. arr.map((item) => (item && item.isA ? item.getState() : item)).
@PaulHax PaulHax force-pushed the vite-vitest-migration branch from dbddb1c to 3a6f3f7 Compare May 21, 2026 18:07
Copy link
Copy Markdown
Collaborator

@PaulHax PaulHax left a comment

Choose a reason for hiding this comment

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

Good to merge!

I squashed the tool migration to 1 commit. I also put another small breaking change commit on top of this.

The vtk.js UMD bundle size is slightly smaller: 2.80 MB -> 2.53 MB; 701 KB -> 659 KB gzipped

@finetjul finetjul added this pull request to the merge queue May 21, 2026
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 36.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@daker
Copy link
Copy Markdown
Collaborator Author

daker commented May 21, 2026

@PaulHax thanks for landing this!

@jourdain
Copy link
Copy Markdown
Collaborator

@daker thanks for your work on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Automated label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants