news Apr 12, 2026 · 2 views · 3 min read

Analyzing Nuxt 3: An Unexpected Size Increase Compared to React

The transition to Nuxt 3 resulted in a larger bundle size, exceeding React by 7%. This unexpected increase highlights the impact of built-in features like vue-router, even in single-page applications, demonstrating the real cost of meta-frameworks.

Understanding the Nuxt 3 Transition

When transitioning a simple Vue 3 application to Nuxt 3, the expectation was a minor increase in bundle size due to the meta-framework's overhead. Initially, a size of 30-35 kB was anticipated, considering the base Vue 3 application was 28.76 kB when gzipped. However, the reality was a 52.01 kB bundle, marking a 7% increase over React's 49 kB baseline. This article explores the reasons behind this size increase and its implications.

The Framework Comparison

In a series of comparisons across different frameworks, the shift to Nuxt 3 presented an anomaly. Previous ports such as Vue, Svelte, and Solid had all resulted in smaller sizes compared to React. For reference, Vue was 28.76 kB, Svelte 18.92 kB, and Solid 8.33 kB, all considerably less than React. Nuxt 3, however, broke this pattern.

Identifying the Size Contributors

The unexpected size increase primarily stems from the inclusion of vue-router and @unhead/vue, which are bundled with Nuxt 3 by default. Even in a single-page application (SPA) with minimal routing and static head content, these packages add approximately 18 kB to the bundle:

  • vue-router: ~10 kB gzip
  • @unhead/vue: ~8 kB gzip

Nuxt's default setup assumes potential needs for routing and dynamic head tags, making these components unavoidable.

The Meta-Framework Tax

This scenario underscores the concept of a "meta-framework tax," where additional features bundled by frameworks like Nuxt, Next.js, or SvelteKit come with a fixed overhead. These features are invaluable for multi-page applications with complex routing and dynamic content management. However, for smaller SPAs, they represent a cost without corresponding benefits.

Code Similarities with Vue

Despite the increased size, the component code in Nuxt is nearly identical to its Vue counterpart, relocated to Nuxt's pages/index.vue structure. The main Nuxt-specific addition is the useHead function for setting a static title, which could be optimized but at the risk of deviating from idiomatic Nuxt patterns.

Excluding Nitro

It's important to note that the Nuxt server engine, Nitro, isn't part of the client bundle in SPA mode. It operates at build time, meaning the 52.01 kB size excludes Nitro, emphasizing that the increase is solely from client-side features.

Choosing the Right Tool

The lesson from this comparison is clear: framework and meta-framework costs are tangible and can influence the choice of tools based on application complexity. For single-page applications, direct use of Vue, Solid, or Svelte offers a more size-efficient solution. Conversely, for more extensive applications, the benefits of a meta-framework like Nuxt can outweigh the additional bundle size.

Consistency Across Ports

The core files such as filter.ts, types.ts, data.ts, and style.css remain consistent across different framework ports, ensuring functionality is not compromised by framework choice.

Testing and Validation

Testing remains uniform across all ports, with 14 Vitest cases validating filter.ts, ensuring reliability without Nuxt-specific layers.

Conclusion

This analysis of Nuxt 3's size increase compared to React highlights the trade-offs involved in using meta-frameworks. While they provide essential features for complex applications, their overhead can be a significant factor for smaller, simpler projects.

Discussion

0 Comments

Leave a Comment

Comments are moderated and will appear after approval.