Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for maximum bundle size #10091

Open
alfaproject opened this issue Feb 19, 2025 · 2 comments
Open

Add support for maximum bundle size #10091

alfaproject opened this issue Feb 19, 2025 · 2 comments

Comments

@alfaproject
Copy link

🙋 feature request

Add support for maximum bundle size like rspack and webpack have.

🤔 Expected Behavior

When setting maximum bundle size, the code splitting algorithm will try to split chunks bigger than the given maximum into smaller chunks if possible.

😯 Current Behavior

Not possible to set a maximum bundle size, I believe.

💁 Possible Solution

We originally used webpack for our needs and have since moved to repack. We are happy with their code splitting functionality which is quite complete so perhaps you can draw inspiration from.

🔦 Context

Our bundling needs are actually for AWS Lambdas for node applications. In reality the code for a lambda is basically a Node.js library with a single function export. One of the optimizations in terms of cold starts is to bundle each lambda code into 1 file (or multiple when splitting at a certain maximum size) instead of deploying all node modules which we all know is not great.

However, we bundle our lambdas without minification because that allows us to have deployed code which is very close to the original and we can edit it on the fly in production whenever there is some issue and have good stack traces on exceptions without fiddling with source maps. The problem is that the AWS Lambda editor does not allow to open files larger than 3MiB, which is where our need comes from. Some of our lambdas are bigger than 3MiB after bundling their dependencies and we need to split it into chunks of that maximum size, so that we can open those files in the web console if we need to edit them on the fly for whatever reason.

@devongovett
Copy link
Member

Not exactly the same thing but you might be able to accomplish something similar with the manual shared bundles feature. There is a split option that can split large bundles into multiple. Requires a bit more configuration though.

@alfaproject
Copy link
Author

We have hundreds of lambdas, that would require tweaking each one individually to more or less be within the thresholds we want. I'd rather keep with rspack for now until I find something better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants