# How to improve bundle size?

**URL:** <https://discourse.aurelia.io/t/how-to-improve-bundle-size/5173>\
**Category:** vNext\
**Created:** [May 23, 2023, 10:41am UTC](https://discourse.aurelia.io/t/how-to-improve-bundle-size/5173 "2023-05-23T10:41:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivan](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/ivan/32/2022_2.png) [@ivan](https://discourse.aurelia.io/u/ivan)\
**Post date:** [May 23, 2023, 10:41am UTC](https://discourse.aurelia.io/t/how-to-improve-bundle-size/5173/1 "2023-05-23T10:41:38Z")

</div>

1. `npx makes aurelia`
2. Choose`Default ESNext Aurelia 2 App`
3. Run `npm run build`

Gets you 1 bundle file that has a `200kb` file size.

Now, installing `@aurelia/router` and registering the `RouterConfiguration` then rebuilding gets you 1 bundle file that has a size of about `320kb`. This also spits out a webpack warning:

```auto
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.

```

This is just the base app, with no other dependencies installed and no additional code written.

Looking at [bundlephobia](https://bundlephobia.com/package/aurelia@2.0.0-beta.6), we can see that the package is tree-shakeable.

 ![Screenshot 2023-05-23 at 12.38.45](https://canada1.discourse-cdn.com/flex027/uploads/aurelia/original/2X/f/fb8b786b7f3778a48ec127c56a8540aca91f48b0.png)

Adding `"sideEffects": false` to the config and rebuilding doesn’t really decease the bundle size.

This is not really a big problem for me, but I am curious how you folks approach this? Any recommendations to decrease the bundle size?

---

<div class="post-metadata">

**Author:** ![bigopon](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/bigopon/32/18_2.png) [@bigopon](https://discourse.aurelia.io/u/bigopon)\
**Post date:** [May 23, 2023, 10:55pm UTC](https://discourse.aurelia.io/t/how-to-improve-bundle-size/5173/2 "2023-05-23T22:55:00Z")

</div>

For bundlephobia, Im not sure what’s being attributed to the size since that looks quite off.  
The plan is to have the core modules around 150kB down from 200kB as in the sample app, together with the router it’ll be about 200kB (The router doesn’t have any size optimization atm yet). A side note that this 150kB already includes all the resources (repeat if promise switch portal etc) so it’ll likely to stay that way no matter how much more new code is added to an application. We won’t be able to get into the 100kB range for now since that’ll require quite a big effort that we cannot afford atm.

---

<div class="post-metadata">

**Author:** ![ivan](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/ivan/32/2022_2.png) [@ivan](https://discourse.aurelia.io/u/ivan)\
**Post date:** [May 24, 2023, 12:31pm UTC](https://discourse.aurelia.io/t/how-to-improve-bundle-size/5173/3 "2023-05-24T12:31:15Z")

</div>

Cool. Thanks for the info.
