Skip to content

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

Open
daker wants to merge 10 commits intoKitware:masterfrom
daker:vite-vitest-migration
Open

feat(Build): modernize build and test tooling with Vite/Vitest & oxlint/oxfmt#3435
daker wants to merge 10 commits intoKitware: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.
  • Remove UMD build.
  • Everything should works as before.

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
Copy link
Copy Markdown
Member

@finetjul finetjul left a comment

Choose a reason for hiding this comment

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

J'ai tout review sauf package-lock.json

LGTM

@daker daker force-pushed the vite-vitest-migration branch 5 times, most recently from dfa94d2 to a9bdd89 Compare March 10, 2026 23:04
return {
name: 'vtk-serve-data',
configureServer(server) {
server.middlewares.use('/Data', (req, res, next) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we serve /data lower case rather that /Data

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Remember, you had to fix that for the website / examples online.

@@ -27,13 +27,12 @@
"url": "https://github.com/kitware/vtk-js/issues"
},
"homepage": "https://github.com/kitware/vtk-js#readme",
"main": "./dist/umd/vtk.js",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can't Vite also generate a umd format too? It can be ok to discontinue umd but we need to let the community know. I think you've updated the doc to promote esm usage as script.

Maybe that is enough. What do you think @finetjul ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Projects that are still using the UMD package :

https://github.com/openUC2/ImSwitch
https://github.com/sandialabs/slycat

image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I do not realize how much work it is to keep umd builds. If it is challenging, ok to drop it.
If we drop umd, the PR should be considered as a breaking change (new major) and documented (in BREAKING_CHANGES.md how to move from umd to esm).

@jourdain
Copy link
Copy Markdown
Collaborator

LGTM, @finetjul I let you merge it. I put some comments as I did not tested.

@jourdain
Copy link
Copy Markdown
Collaborator

Should we try to rebase? What is preventing us to merge that PR?

@jourdain
Copy link
Copy Markdown
Collaborator

@PaulHax @finetjul @sankhesh

@daker
Copy link
Copy Markdown
Collaborator Author

daker commented Mar 25, 2026

@jourdain i can try to bring back the umd build with vite but we need to test the builds to see if nothing is broken.

@jourdain
Copy link
Copy Markdown
Collaborator

@finetjul would you be able to test the build?

@finetjul
Copy link
Copy Markdown
Member

@finetjul would you be able to test the build?

not before next week

@daker daker force-pushed the vite-vitest-migration branch from f651a58 to 68d34ac Compare March 25, 2026 19:34
@daker daker force-pushed the vite-vitest-migration branch 2 times, most recently from 6f5a9ab to 39c691d Compare March 25, 2026 19:49
@daker daker force-pushed the vite-vitest-migration branch from 39c691d to 7aa3181 Compare March 25, 2026 19:56
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.

npm run docs:build-examples fails because Rollup packages removed from package.json but still imported in build-examples.mjs

UMD bundle still works, thanks for that.

setTimeout(createRW, 100);
} else {
popMonitorGLContextCount();
Promise.all(images).then(gc.releaseResources);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return Promise.all(images).then(gc.releaseResources);

We need to wait for these promises to finish before ending the test.

'vite.example.config.mjs'
);
const DEFAULT_HOST = '0.0.0.0';
const DEFAULT_PORT = '9999';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks like we changed the docs in the PR to say examples are on 3000, but I think this will carry through and make the example port 9999

outDir: umdOutputDir,
emptyOutDir: true,
sourcemap: true,
cssCodeSplit: false,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should probaly note in BREAKING_CHANGES.md that UMD users will need to add <link rel="stylesheet" href="vtk.js.css"> now cuz CSS is not injected into JS bundle.

Or we could not break things by adding a plugin to bundle CSS in UMD.

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.

4 participants