Repository navigation
Open
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
- https://pkg-size.dev/wxt@%5E0.21?no-peers
- https://npmgraph.js.org/?q=wxt@^0.21
- https://node-modules.dev/grid/depth#install=wxt@^0.21
There's a couple options for cleaning these up:
- Is the dependency actually needed anymore? No? Drop it
- Can the dependency be replaced with a smaller alternative? Yes? Do it
- Is the dependency small and not likely to have a vulnerability? Yes? Inline it
- Is the dependency something that can be replaced by a single function? Yes? DIY it
- 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
-
import-meta-resolve(79KB / 1 package, ESM) - Drop, not needed in Node 22 -
publish-browser-extension(933KB / 7 packages, ESM)- Released v6 → 333KB / 4 packages
- Explored inlining final deps, but decided not to: chore: Inline deps aklinker1/publish-browser-extension#87
-
@aklinker1/rollup-plugin-visualizer(1.7MB / 23 packages, CJS) - Replace with https://sonda.dev or DIY it (how hard can it be? lol). What does nuxt's analysis tool and devtools use? OR trim down my fork to removeyargsandopen- Issue for sonda already exists: Support WXT Natively filipsobol/sonda#195
- Rolldown provide's it's own bundle analysis tool, though it is experimental and this would lock us into Vite even more. We would just have to render a UI: https://rolldown.rs/builtin-plugins/bundle-analyzer
- I got an extension working with vite's environment API, Play around with new Vite environment APIs #1046 (comment), but
rollup-plugin-visualizerdidn't work when building in series, only in parallel, meaning it's getting lucky with a race condition. So my fork is still necessary
Medium Priority
-
open(83KB / 12 packages, ESM) - Replace withtiny-open? -
prompts(203KB / 3 packages, CJS) - Replace with@topcli/prompts -
async-mutex(153KB / 2 packages, ESM + CJS) - replace withsuperlock -
@wxt-dev/storage(1.1MB / 8 packages, ESM) - Inlinedequal, replaceasync-mutexwithsuperlock -
jszip(1.8MB / 13 packages, CJS) - There's got to be a zero-dependency zip library we can replace this with...uzipis tiny and might work- But maybe
node:zlibcan do it in a few lines? More than a few, but yes: https://share.gemini.google/gYafpOMSmyfo - Or spawn
zipsubprocesses 🤔 fflatewas suggested: Drop, Replace, Inline, DIY, or Minimize Dependencies #2523 (comment)- chore(deps): Replace
jszipwith@aklinker1/zero-zip#2538 - chore(deps): Inline small deps #2560
Low Priority
-
scule(30KB / 1 package, ESM + CJS) - Inline to tree-shake CJS -
ci-info(30KB / 1 package, CJS) - Inline to tree-shake everything we don't use| -
get-port-please(29KB / 1 package, ESM + CJS) - Inline to tree-shake CJS out -
filesize(58KB / 1 package, ESM + CJS) - Inline or DIY it. 58 kB is a bit large for a few if statements... -
is-wsl(10KB / 3 packages, ESM) - Is this apart ofci-info? If not, inline. -
normalize-path(9.2KB / 1 package, CJS) - Inline or DIY -
ohash(20KB / 1 package, ESM) - Inline or DIY -
picomatch (93KB / 1 package, CJS) - Can this be dropped?- Let's cleanup the other deps that depend on it first: chore(deps): replace
picomatchwithpath#2559 (comment)
- Let's cleanup the other deps that depend on it first: chore(deps): replace
-
nanospinner(17KB / 2 packages, CJS) - Inline -
nano-spawn(45KB / 1 package, ESM) - vstinyexec? don't need both,tinyexecis smaller... -
@webext-core/isolated-element(13KB / 2 packages, ESM) - could DIY this- Inlined only dependency: aklinker1/webext-core@eff4212
-
dotenv-expand(123KB / 2 packages, CJS) - Inlining it should remove the dependency ondotenv, 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?- Potential OXC replacement: c394e4b
- I think we're going to have to keep this one.
-
@webext-core/fake-browser(1.1MB / 6 packages, ESM) - Simplify thebaseobject 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.readdirpdoesn'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 withhtmlparser2, 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 downloadcittyis 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
Reacted by Patryk Kuniczak, Gliches and Brian Zhou
Metadata
Metadata
Assignees
Labels
No labels
Activity
rxliuli commentedon Jul 30, 2026
If you want to replace jszip, you can try using fflate. I've used it in a website before and it worked pretty well.
aklinker1 commentedon Jul 30, 2026
They say it's only 8kb... but why is the
node_modulessize nearly 800 kB lolhttps://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 🤔
aklinker1 commentedon Jul 30, 2026
I created this: https://github.com/aklinker1/zero-zip
3.77 kB unpacked. Would inline it to reduce it to ~1.38 kB
aklinker1 commentedon Jul 31, 2026
Here's the comparison between
fflateand@aklinker1/zero-zipjszipfflate@aklinker1/zero-zippackages/wxt-demoGonna go with my package.
aklinker1 commentedon Jul 31, 2026
As long as we use
unbundlemode, we can't inline any dependencies, which is unfortunate...aklinker1 commentedon Jul 31, 2026
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.
aklinker1 commentedon Aug 1, 2026
Got inlining working in: #2557
nishu-murmu commentedon Aug 3, 2026
couple of people are contributing this. Should I pin this issue and unpin the #2262 cause it has already been resolved? @aklinker1
nishu-murmu commentedon Aug 3, 2026
And how to test those packages which are basically changes of cli? like wxt init and other commands??
@aklinker1 @PatrykKuniczak .
picomatch(93KB / 1 package, CJS) - Can this be dropped? #2566picomatch(93KB / 1 package, CJS) - Can this be dropped? #2566PatrykKuniczak commentedon Aug 3, 2026
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 :)
aklinker1 commentedon Aug 4, 2026
Yup, please do.
You can run them in the
packages/wxtdirectory (viabun wxt init ...), or use pkg.pr.new and pnpmx/bunx/npmx to run the built package (bunx https://pkg.pr.new/wxt/<hash> initI think...)aklinker1 commentedon Nov 15, 2026
Some options for replacing
linkedom: #2756