Skip to content

fix: reduce published package size of component-library and icon-kit - #1289

Draft
Arnold Stoba (arnoldstoba) wants to merge 5 commits into
mainfrom
chore/optimize-package-size
Draft

fix: reduce published package size of component-library and icon-kit#1289
Arnold Stoba (arnoldstoba) wants to merge 5 commits into
mainfrom
chore/optimize-package-size

Conversation

@arnoldstoba

@arnoldstoba Arnold Stoba (arnoldstoba) commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What?

Removes dead weight from the published @shopware-ag/meteor-component-library and @shopware-ag/meteor-icon-kit packages. The component library shrinks from 43.4 MB unpacked (4,922 files) to 16.8 MB (2,500 files) — a 3.7 MB tarball — without changing a single byte of runtime code that consumers use.

Why?

npm analytics flagged the component library at 43.4 MB unpacked (173 MB installed with dependencies) — far larger than comparable libraries. A byte-level analysis of the published tarball showed that most of it is never used by any consumer: unreachable source maps, unpublished-tooling dependencies, the raw src tree, and a font package whose files are already copied into dist.

Meteor is a public library — consumers are the shopware/shopware administration and external extension developers building apps and plugins. Every change in this PR is therefore justified at the artifact level (properties of the published package itself, which hold for every consumer), not just by checking known consumers.

How?

One commit per finding, each with a changeset (all patch):

  • fix(component-library): stop publishing source maps (23.6 MB, ~55% of the package)

    • Reason: Since fix: source map warning #1055 maps are built with sourcemap: "hidden", which strips the sourceMappingURL comments. We verified via grep over the published tarball that zero files reference the 2,130 .map files.
    • Why not breaking: Files that nothing references cannot be loaded by any debugger, bundler, or error tracker — for any consumer. sourcemap: false additionally removes the warning that fix: source map warning #1055 worked around.
  • fix(icon-kit): move Figma sync tooling to devDependencies (~10 MB install weight: zod, winston, ora, dotenv, @t3-oss/env-core)

    • Reason: These are only imported by the icon sync script in src/, which is not part of the published package (files: ["icons"]).
    • Why not breaking: The published tarball is byte-identical before and after (922 files, icons only) — only the install tree changes. Edge case: projects importing one of these packages without declaring it (phantom dependency via hoisting) must add it to their own dependencies; such imports were never supported, pnpm/Yarn PnP already reject them, and the changeset documents it.
  • fix(component-library): move inter-ui to devDependencies (15.6 MB install weight)

    • Reason: inter-ui is build-time-only: emitInterFontAssets copies the two woff2 files into dist/assets/fonts/ and generates dist/fonts.css with relative URLs.
    • Why not breaking: The Inter font still ships inside the package and the documented ./font.css export is unchanged (verified in a fresh build) — self-contained for every consumer. The build helper throws if any ~inter-ui reference survives the URL rewrite, so a regression cannot build. Same phantom-dependency edge case as above, documented in the changeset.
  • fix(component-library): stop publishing the src directory (2.3 MB, including 141 .spec/.stories files)

    • Reason: src was published alongside dist but is not part of the public API.
    • Why not breaking: The exports map has only ever exposed dist paths, so src is unreachable through package imports in any modern resolver (Node ≥ 12.20, webpack 5, Vite, Rollup) — this holds for every consumer, not just known ones. Paths that bypass the package API (raw node_modules/.../src SCSS imports, webpack-4-era resolvers that ignore exports) were never officially supported and are called out in the changeset; the shipped SCSS was not usable standalone anyway (it depends on build-time aliases and injected variables). As an additional check, the primary consumer shopware/shopware contains zero src references (full-text search including SCSS and build configs) and our docs never instructed such imports.

Testing?

  • Component library: full build green, 649 unit tests passed (2 skipped), vue-tsc type check clean.
  • Icon kit: 16 unit tests passed; npm pack --dry-run confirms identical publish contents.
  • Published-artifact verification: fresh tarball contains 0 .map files, no src/, fonts present in dist/assets/fonts/ with correctly rewritten dist/fonts.css.
  • Reference-consumer verification: full production build of the shopware/shopware administration (Vite 6, including plugin builds) succeeds, plus a manual browser test against a yalc-linked build of this branch. External apps/plugins cannot be tested individually — they are covered by the artifact-level guarantees above (identical tarball, unreferenced files removed, unchanged exports surface), with the known edge cases documented in the changesets.

Anything Else?

  • Follow-up for the remaining 16.8 MB is tracked in Reduce published package size: drop CJS dual-build and shrink generated .d.ts files #1288 (drop the CJS dual-build in the next major, shrink the exploded .d.ts files).
  • A bigger lever — externalizing the ~40 bundled runtime dependencies (package would drop to ~7.6 MB and consumers would stop double-shipping TipTap/ProseMirror/CodeMirror) — was verified end-to-end against a real admin production build but is intentionally not part of this PR; it deserves its own discussion (needs date-fns unpinned to ^4.1.0 and a proper vue peerDependency declaration).

The maps were built with sourcemap: "hidden" since #1055, so no
published file references them. They accounted for 23.6 MB (~55%)
of the 43.4 MB unpacked package while being unreachable by any
consumer tooling.
@t3-oss/env-core, dotenv, ora, winston and zod are only used by the
icon sync script in src/, which is not part of the published package
(files: ["icons"]). Consumers installed ~10 MB of unused tooling.
The Inter font files are copied into dist/assets/fonts/ at build time
and served through the ./font.css export, so the published package is
fully font-self-contained. Nothing in dist references the inter-ui
package, yet every consumer installed its 15.6 MB.

The lockfile update also covers the icon-kit devDependencies move
from the previous commit.
src/ added 2.3 MB (including 141 spec and story files) to every
install. The exports map only exposes dist, so src has been
unreachable through package imports; shopware/shopware contains no
references to it either.
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
meteor-docs Ready Ready Preview, Comment Jul 24, 2026 11:26pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
meteor-storybook Ignored Ignored Preview Jul 24, 2026 11:26pm

Request Review

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