Skip to content

v8.1.1 Optimizer fails with RangeError: WebAssembly.Memory.Grow() on react-icons #23189

Closed

Description

@mainangethe

Describe the bug

Summary

When using Vite 8.1.1 with react-icons (e.g., react-icons/si, react-icons/fa), the dependency optimizer crashes during the scanning phase with a RangeError: WebAssembly.Memory.grow(): Maximum memory size exceeded. The error originates from the Rolldown‑based optimizer attempting to parse the large barrel exports of react-icons.

Downgrading to Vite 7.2.7 resolves the issue completely, confirming a regression in Vite 8.



Expected Behavior

Vite should successfully pre‑bundle react-icons without crashing, as it does in Vite 7.2.7.


Actual Behavior

The optimizer crashes with a WebAssembly memory error when attempting to parse react-icons barrel files. The error occurs during the prepareRolldownOptimizerRun phase, indicating the new Rolldown‑based optimizer is unable to handle the large number of exports in react-icons.


Additional Context

  • The error occurs even with optimizeDeps.rolldown: false, suggesting the flag is not fully respected or the Rolldown parser is still invoked for certain analysis tasks.
  • The react-icons package contains large barrel files (e.g., si/index.mjs exports hundreds of icons), which likely triggers the parser’s memory limit.
  • The container has 7.6 GiB of RAM available, and Node’s heap limit is 2 GiB, so this is not a system resource issue — it’s a bug in the optimizer’s memory management.
  • Workarounds:
    • Downgrade to Vite 7.2.7 (stable).
    • Use optimizeDeps.include to force esbuild pre‑bundling (though this may still fail in some cases).

Reproduction

https://stackblitz.com/edit/vitejs-vite-urontafm?file=src%2FApp.jsx

Steps to reproduce

Steps to Reproduce

  1. Create a fresh Vite + React project with Vite 8.1.1:

    pnpm create vite my-app --template react-ts
    cd my-app
    pnpm add -D vite@8.1.1
  2. Install react-icons:

    pnpm add react-icons
  3. Import any icon set in a component (e.g., src/App.tsx):

    import { SiReact } from 'react-icons/si';
  4. Run the dev server:

    pnpm dev
  5. Observe the crash during dependency scanning:

    file:///.../vite/dist/node/chunks/node.js:3517
    D > 0 && C.memory.grow(Math.ceil(D / 65536));
              ^
    RangeError: WebAssembly.Memory.grow(): Maximum memory size exceeded
        at parse$2 (...)
        at extractExportsData (...)
        at async prepareRolldownOptimizerRun (...)
    

System Info

## Environment

| Component | Version |
|-----------|---------|
| Vite | 8.1.1 |
| `react-icons` | 5.7.0 |
| Node.js | v22.23.2 |
| Package Manager | pnpm 10.34.4 |
| OS | Linux (Docker container, 7.6 GiB available) |
| Plugin | `@vitejs/plugin-react-swc` 4.3.1 |
| `optimizeDeps.rolldown` | `false` (explicitly set, but error still references Rolldown) |

**`vite.config.ts`:**

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'

export default defineConfig({
  plugins: [react()],
  optimizeDeps: {
    rolldown: false, // explicitly disabled, but crash still occurs
  },
})

Used Package Manager

pnpm

Logs

No response

Validations

Activity

  1. added theissue type on Aug 6, 2026
  2. btea commented on Aug 6, 2026

    @btea
    Contributor

    Based on the example you provided, vite8.2.0 is installed, and it seems to be working properly.

    screen Image
  3. sapphi-red commented on Aug 7, 2026

    @sapphi-red
    Member

    This was fixed in 8.1.2 by #22827

  4. locked and limited conversation to collaborators on Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions