wxt-dev / wxt-dev/wxt

Drop, Replace, Inline, DIY, or Minimize Dependencies

Open
#2,523 11 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
10.5k
Forks
564
PR merge metrics
No merged PRs in 30d

Description

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
  • open (83KB / 12 packages, ESM) - Replace with tiny-open?
    • #2527
  • prompts (203KB / 3 packages, CJS) - Replace with @topcli/prompts
    • #2528
  • async-mutex (153KB / 2 packages, ESM + CJS) - replace with superlock
    • #2529
  • @wxt-dev/storage (1.1MB / 8 packages, ESM) - Inline dequal, replace async-mutex with superlock
    • #2529
    • #2530
  • jszip (1.8MB / 13 packages, CJS) - There's got to be a zero-dependency zip library we can replace this with...
Low Priority
  • scule (30KB / 1 package, ESM + CJS) - Inline to tree-shake CJS
    • #2560
  • ci-info (30KB / 1 package, CJS) - Inline to tree-shake everything we don't use|
    • #2543
  • get-port-please (29KB / 1 package, ESM + CJS) - Inline to tree-shake CJS out
    • #2576
  • filesize (58KB / 1 package, ESM + CJS) - Inline or DIY it. 58 kB is a bit large for a few if statements...
    • #2589
  • is-wsl (10KB / 3 packages, ESM) - Is this apart of ci-info? If not, inline.
    • #2560
  • normalize-path (9.2KB / 1 package, CJS) - Inline or DIY
    • #2557
  • ohash (20KB / 1 package, ESM) - Inline or DIY
    • #2560
  • picomatch (93KB / 1 package, CJS) - Can this be dropped?
  • nanospinner (17KB / 2 packages, CJS) - Inline
    • #2567
  • nano-spawn (45KB / 1 package, ESM) - vs tinyexec? don't need both, tinyexec is smaller...
    • #2544
  • @webext-core/isolated-element (13KB / 2 packages, ESM) - could DIY this
  • dotenv-expand (123KB / 2 packages, CJS) - Inlining it should remove the dependency on dotenv, will be tree-shaken out?
  • magicast (5.3MB / 6 packages, ESM) - Only tool that includes babel, would like to replace, maybe with https://oxc.rs/docs/guide/usage/transformer.html?
  • @webext-core/fake-browser (1.1MB / 6 packages, ESM) - Simplify the base object to a proxy
  • c12 (404KB / 8 packages, ESM) - There's a lot of dependencies here that probably aren't required for our use-case. Might want to DIY it now that node can import TS files
  • unimport (3MB / 30 packages, ESM) - No idea how this can be simplified, but it should be. Probably would need to contribute to it.
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the unresolved dependency entries, especially rollup-plugin-visualizer, dotenv-expand, c12, and unimport, and inspect the linked upstream discussions before choosing one. Done means a concrete dependency reduction is implemented and the issue's checklist and size accounting are updated.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.