Skip to main content
Lightning Jar - Web Studio Lightning Jar Wordmark

Findings No. 112

Vite's default worker format inlines stock Verovio

Vite's default worker format inlines stock Verovio unless you set worker format to es

Barmark Tooling verified

Barmark's score package ships two Verovio builds, a lighter default and a heavier stock fallback, and the design meant for a bundler to keep stock split out as its own chunk, downloaded only when the fallback build actually ran. Vite's default build does something else. Vite builds a web worker in iife format unless told otherwise, and an iife worker cannot be split into chunks, so the dynamic import("verovio/wasm") gets inlined into the worker itself. The result: a worker of 8,577 kB (2,536 kB gzipped) with stock Verovio baked in, plus the lighter build's .wasm, 2,957 kB (995 kB gzipped), fetched alongside it. Total load: about 7.4 MB (2.4 MB gzipped), more than stock alone would have cost. Setting worker: { format: "es" } restores the split: the worker drops to 213 kB (73 kB gzipped), the lighter glue to 29 kB (11 kB), and stock becomes its own 8,335 kB (2,451 kB) chunk, fetched only when the fallback path runs. The README now tells every Vite consumer to set that option, and scripts/score-bundlers.ts fails the build if the worker contains stock or the stock chunk loads when nothing asked for it. The general rule: a bundler's default settings can override an architecture's lazy loading plan, so a component with a heavy fallback path needs its actual bundle output checked, not only documented.

Receipt: Barmark, packages/score/README.md ("Bundling the worker"), scripts/score-bundlers.ts.

Ask Eljay

Ask about the studio's work, research, packages, or writing. A few starters:

Answers come from this site's own content and link their sources. For anything that matters, email hello@lightningjar.com.