Describe the bug π
packages/fragments/dist/Worker/worker.mjs built from c4d48d7 (the 3.4.7 bump) is 3 276 108 bytes (gzip 446 KB). Built from main @ dceedc8 it is 7 429 033 bytes (gzip 767 KB). The main-thread bundle is unaffected (1.36 β 1.37 MB).
The difference is web-ifc. dceedc8 ("fix(parser): streaming STEP tokenizer with web-ifc tape parity") added Utils/ifc-parsing-utils.ts, which does
import * as webIfc from "web-ifc";
β¦
const { STRING, LABEL, ENUM, REAL, REF, INTEGER } = webIfc;
β¦
const typecode = (webIfc as Record<string, unknown>)[name.toUpperCase()];
and Utils/index.ts now re-exports it (export * from "./ifc-parsing-utils"; export * from "./ifc-stream";). The worker entry reaches that barrel β virtual-fragments-model.ts and edit-request-index.ts import EditRequest/EditUtils from ../../../Utils β and since the worker build cannot externalise anything, the whole web-ifc module (with its wasm loader glue) lands in the worker, where nothing calls it. Every app ships this file to every visitor; the old worker had zero references to IfcAPI/web-ifc, the new one has 12.
What I expect: the worker bundle contains what the worker runs.
What actually happens: +4.1 MB (+320 KB gzipped) of web-ifc in the worker.
Suggested fix: define the six token codes locally (they are small integer constants) or import them from a constants-only module, and keep ifc-parsing-utils/ifc-stream out of the barrel the worker imports (export them from the package index instead). Worth landing before 3.5.0 (#189), since the release would otherwise double the worker download for everyone.
Reproduction βΆοΈ
yarn install && yarn build-core on c4d48d7 and on main, then compare packages/fragments/dist/Worker/worker.mjs (ls -l, grep -c IfcAPI).
Steps to reproduce π’
- Build
main (dceedc8).
ls -l packages/fragments/dist/Worker/worker.mjs β 7.4 MB; grep -c "IfcAPI" β¦/worker.mjs β 12.
- Same on
c4d48d7 β 3.3 MB, 0 matches.
System Info π»
Node 24, yarn 3.2.1 (vendored), vite 5 worker build from vite.config-worker.ts
web-ifc 0.0.77
Used Package Manager π¦
yarn
Validations β
Describe the bug π
packages/fragments/dist/Worker/worker.mjsbuilt fromc4d48d7(the 3.4.7 bump) is 3 276 108 bytes (gzip 446 KB). Built frommain@dceedc8it is 7 429 033 bytes (gzip 767 KB). The main-thread bundle is unaffected (1.36 β 1.37 MB).The difference is web-ifc.
dceedc8("fix(parser): streaming STEP tokenizer with web-ifc tape parity") addedUtils/ifc-parsing-utils.ts, which doesand
Utils/index.tsnow re-exports it (export * from "./ifc-parsing-utils"; export * from "./ifc-stream";). The worker entry reaches that barrel βvirtual-fragments-model.tsandedit-request-index.tsimportEditRequest/EditUtilsfrom../../../Utilsβ and since the worker build cannot externalise anything, the whole web-ifc module (with its wasm loader glue) lands in the worker, where nothing calls it. Every app ships this file to every visitor; the old worker had zero references toIfcAPI/web-ifc, the new one has 12.What I expect: the worker bundle contains what the worker runs.
What actually happens: +4.1 MB (+320 KB gzipped) of web-ifc in the worker.
Suggested fix: define the six token codes locally (they are small integer constants) or import them from a constants-only module, and keep
ifc-parsing-utils/ifc-streamout of the barrel the worker imports (export them from the package index instead). Worth landing before 3.5.0 (#189), since the release would otherwise double the worker download for everyone.ReproductionβΆοΈ
yarn install && yarn build-coreonc4d48d7and onmain, then comparepackages/fragments/dist/Worker/worker.mjs(ls -l,grep -c IfcAPI).Steps to reproduce π’
main(dceedc8).ls -l packages/fragments/dist/Worker/worker.mjsβ 7.4 MB;grep -c "IfcAPI" β¦/worker.mjsβ 12.c4d48d7β 3.3 MB, 0 matches.System Info π»
Used Package Manager π¦
yarn
Validations β