Replies: 1 comment
-
Why do you think you can reduce the size by omitting |
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
-
Is it possible to bundle React Router's server side code into a single binary and remove the need for node_modules with react-router build?
I have a medium sized project with 23 node modules installed in the production dependencies in the package.json file. All of them are used, they're just normal packages that I think many developers would have, eg: firebase, stripe, algoliasearch etc. The resulting docker container is very large at +400Mb 🤯 and the size is mostly due to the node_modules folder which is a whopping +300Mb.
I'm using the default out-of-the-box template with the Dockerfile and npm/node22.
As a quick test, I tried bundling the build/server/index.js with esbuild and the end result was just 4.7Mb. It didn't work unfortunately but it has made me think that there should be a way to drastically reduce the size of the docker container if I can remove the junk in node_modules - therefore making the cold starts faster, reducing storage and network bandwidth costs.
At this time, all ideas are welcome - for example I've heard that Bun can produce a single binary file?
Beta Was this translation helpful? Give feedback.
All reactions