Skip to content

build(vite): add default export to ColorMaps.json.js virtual stub#12

Closed
PaulHax wants to merge 2 commits into
vtk-js-upgradefrom
colormaps-default-export
Closed

build(vite): add default export to ColorMaps.json.js virtual stub#12
PaulHax wants to merge 2 commits into
vtk-js-upgradefrom
colormaps-default-export

Conversation

@PaulHax
Copy link
Copy Markdown
Owner

@PaulHax PaulHax commented May 21, 2026

Stacked on Kitware#879 (base branch: vtk-js-upgrade). This PR is just the
single-line ColorMaps stub change, so the new-bundle fix can be reviewed
on its own.

What

VolView's virtual-modules plugin in vite.config.ts stubs
@kitware/vtk.js's internal ColorMaps.json.js to drop the unused
built-in colormap data. The stub exported only the named binding v.

Why

v was never a vtk.js contract. It is the minified internal symbol
Rollup emitted for that JSON module. vtk.js v36
(Kitware/vtk-js#3435)
swaps Rollup for Vite/Rolldown, which instead emits ColorMaps.json.js
with export default, and ColorMaps.js imports it as a default.
Against the named-only stub the build fails:

"default" is not exported by ".../ColorMaps.json.js"

Change

- return 'export const v = []';
+ return 'export const v = []; export default [];';

Verified by building VolView against a local pack of vtk-js PR 3435.

PaulHax added 2 commits May 17, 2026 16:13
Bumps @kitware/vtk.js from ^32.12.1 to ^35.15.1.

Per vtk.js BREAKING_CHANGES (33 -> 34), several volume mapper setters
were moved from the mapper onto the volume property. Adjust callers to
invoke the new property-based setters:

- src/utils/volumeProperties.ts: route the relevant set* calls through
  the volume's property instead of the mapper.
- src/components/vtk/VtkBaseVolumeRepresentation.vue: same migration for
  the representation component's mapper/property interactions.
VolView's virtual-modules plugin stubs @kitware/vtk.js's ColorMaps.json.js
to drop the unused built-in colormap data. The stub exported only the named
binding `v`, which matched the minified internal symbol that vtk.js's Rollup
build emitted for that module.

vtk.js v36 (Kitware/vtk-js#3435) swaps Rollup for Vite/Rolldown. The new
build emits ColorMaps.json.js with `export default` instead of the minified
name `v`, and ColorMaps.js imports it as a default. The named-only stub then
fails the build with: "default" is not exported by ColorMaps.json.js

Exporting both `v` and `default` keeps the stub valid on vtk.js v35 (named
`v`) and v36 (default), so the eventual v36 bump needs no further change.
@PaulHax
Copy link
Copy Markdown
Owner Author

PaulHax commented May 21, 2026

Superseded by Kitware#879, which now upgrades straight to vtk.js v36.0.0 and folds in this ColorMaps stub fix (the v35.15.1 intermediate step is no longer needed now that v36 has shipped).

@PaulHax PaulHax closed this May 21, 2026
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