Replies: 1 comment
-
|
while i appreciate your efforts, i recommend first fully understanding what is implemented how and why, especially when it comes to our usage of babel. we won't remove babel-dead-code-elimination nor babel itself. chokidar might be bumpable though. try it out and create a PR! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Introduction
I had the impression that my node_modules were really big and massive. I looked and saw that TanStack had a huge dependency graph.
I tried to analyze and help. and I hope this can helps.
Here is the dependency graph. The red parts are mainly Babel with my suggestions, we can remove almost all of the commonjs from tanstack-start.
in the end, only three commonjs sub-deps would remain:
use-sync-external-store, tiny-warning and source-mapvite starttime.Cheerio
The first one I see is cheerio, which takes up a lot of space for a use that is extremely simplistic.
21 Dependencies that could be simplified. You can use of transformIndexHtml or a regex.
Used only one time in
packages/start-plugin-core/src/dev-server-plugin/plugin.tsExtractHTML.ts
Plugin.ts
chokidar
The second is [email protected] in
(@tanstack/router-plugin). Here, the solution is quite simple: migrate to v4, which reduces sub-dependencies from 13 to 1.So no real action is necessary other than updating.
xmlbuilder2
7 subs-deps (Total 442 KB) that could be simplified with no Dependency. (I can provide codes if needed.)
Only used one time in
tanstack/start-plugin-coreSiteMap.ts

recast
This dependency has 5 sub-dependencies, including commonjs, Can be replaced by oxc-parser better maintained, popular, fast and lite weight.
Used in only two files in
@tanstack/router-generatorTransorm.ts

Utils.ts
Babel
This is by far the biggest piece that can reduce weight by almost 70% and dependencies by 50%. Babel can be replaced by OXC.
Faster, more powerful, infinitely smaller.
It's so complicated to navigate the graph that I may omit references.
It's more of a refactoring that may take a little time but will be beneficial in the long term.
babel-dead-code-elimination is not necessary because oxc/vite/rolldown natively integrates everything needed for bundling/minification.
You can remove :
Beta Was this translation helpful? Give feedback.
All reactions