Skip to content

Drop, Replace, Inline, DIY, or Minimize Dependencies #2523

Description

@aklinker1

Feature Request

I really want to decrease the size of WXT. As of 0.21.2, here's it's install size (excluding peers):

22MB / 156 packages

There's a couple options for cleaning these up:

  1. Is the dependency actually needed anymore? No? Drop it
  2. Can the dependency be replaced with a smaller alternative? Yes? Do it
  3. Is the dependency small and not likely to have a vulnerability? Yes? Inline it
  4. Is the dependency something that can be replaced by a single function? Yes? DIY it
  5. After reviewing, could the package be cleaned up? Yes? Contribute to it

Dependencies

This is a list of all of WXT's 37 direct dependencies, and what, if anything, we can do to reduce it's size:

High Priority

Medium Priority

Low Priority

Fine As-is

  • @1natsu/wait-element (46KB / 3 packages, ESM) - Small enough as-is, though I would like to see it have 0 dependencies
  • @webext-core/match-patterns (9.9KB / 1 package, ESM) - small, zero deps, it's fine
  • @wxt-dev/browser (870KB / 4 packages, ESM) - Fine, kinda big, but not much can be done about it
  • cac (41KB / 1 package, ESM) - Fine, could inline it, but it's fine.
  • chokidar (105KB / 2 packages, ESM) - fine for now. readdirp doesn't seem necessary anymore, could contribute to it's removal
  • consola (322KB / 1 package, ESM + CJS) - Kinda big, but fine for now. Don't like that it still ships CJS
  • defu (21KB / 1 package, ESM + CJS) - Small, could inline, but probably fine
  • giget (184KB / 1 package, ESM) - Kinda large, but it does it's job well.
  • hookable (24KB / 1 package, ESM) - Could inline, but it's fine as-is for now.
  • json5 (235KB / 1 package, FAUX) - Small-ish, one package, probably fine as is.
  • linkedom (3.6MB / 20 packages, ESM) - Parsing the entrypoint HTML files could be accomplished with htmlparser2, but I don't think the fake browser environment can be created without a library like this...
  • nypm (160KB / 4 packages, ESM) - We don't need it's CLI, so having to download citty is a bit of a waste, but it's not very large for the trouble.
  • tinyglobby (186KB / 3 packages, ESM + CJS) - Necessary, could contribute to drop CJS

Activity

  1. rxliuli commented on Jul 30, 2026

    @rxliuli
    Contributor

    If you want to replace jszip, you can try using fflate. I've used it in a website before and it worked pretty well.

  2. aklinker1 commented on Jul 30, 2026

    @aklinker1
    MemberAuthor

    If you want to replace jszip, you can try using fflate. I've used it in a website before and it worked pretty well.

    They say it's only 8kb... but why is the node_modules size nearly 800 kB lol

    High performance (de)compression in an 8kB package

    https://pkg-size.dev/fflate - 797KB / 1 package

    We can try inlining it to trim it down to just the one ESM file we need, which is still 91 kb 🤔

    Image
  3. aklinker1 commented on Jul 30, 2026

    @aklinker1
    MemberAuthor

    I created this: https://github.com/aklinker1/zero-zip

    3.77 kB unpacked. Would inline it to reduce it to ~1.38 kB

  4. aklinker1 commented on Jul 31, 2026

    @aklinker1
    MemberAuthor

    Here's the comparison between fflate and @aklinker1/zero-zip

    Metric jszip fflate @aklinker1/zero-zip
    Speed to zip packages/wxt-demo 53 ms 65 ms 27 ms
    Size of zip 97.65 kB 98.23 kB 97.1 kB
    Max memory used 415912 366556 407784
    Install footprint 1.8MB / 13 packages 797KB / 1 package 3.8KB / 1 package

    Gonna go with my package.

  5. aklinker1 commented on Jul 31, 2026

    @aklinker1
    MemberAuthor

    As long as we use unbundle mode, we can't inline any dependencies, which is unfortunate...

  6. aklinker1 commented on Jul 31, 2026

    @aklinker1
    MemberAuthor

    Some other packages for size reference (at the time of writing):

    Doing pretty good size-wise and dependency-wise, but dependencies could come down a little.

  7. aklinker1 commented on Aug 1, 2026

    @aklinker1
    MemberAuthor

    Got inlining working in: #2557

  8. nishu-murmu commented on Aug 3, 2026

    @nishu-murmu
    Collaborator

    couple of people are contributing this. Should I pin this issue and unpin the #2262 cause it has already been resolved? @aklinker1

  9. nishu-murmu commented on Aug 3, 2026

    @nishu-murmu
    Collaborator

    And how to test those packages which are basically changes of cli? like wxt init and other commands??
    @aklinker1 @PatrykKuniczak .

  10. pinned and unpinned a comment on Aug 3, 2026
  11. PatrykKuniczak commented on Aug 3, 2026

    @PatrykKuniczak
    Collaborator

    And how to test those packages which are basically changes of cli? like wxt init and other commands?? @aklinker1 @PatrykKuniczak .

    I'm not tracking those changes, because of the lack of the free time.
    I only want to merge my PRs, right now.
    Maybe in the near future i'll have more free time, and be able to be back :)

  12. aklinker1 commented on Aug 4, 2026

    @aklinker1
    MemberAuthor

    couple of people are contributing this. Should I pin this issue and unpin the #2262 cause it has already been resolved? @aklinker1

    Yup, please do.

    And how to test those packages which are basically changes of cli? like wxt init and other commands??

    You can run them in the packages/wxt directory (via bun wxt init ...), or use pkg.pr.new and pnpmx/bunx/npmx to run the built package (bunx https://pkg.pr.new/wxt/<hash> init I think...)

  13. pinned this issue on Aug 4, 2026
  14. aklinker1 commented on Nov 15, 2026

    @aklinker1
    MemberAuthor

    Some options for replacing linkedom: #2756

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions