Skip to content

Vite 8 / Rolldown build generates missing init_*_esm_bundler helpers with Vue multi-page build #22583

Description

@kysyuan126

Describe the bug

Title

Vite 8 / Rolldown build generates missing init_*_esm_bundler helpers with Vue multi-page build and circular dependencies

Description

We are maintaining a Vue 3 multi-page application located at:

03-Frontend/hym-labs-webapp

The project works correctly in Vite dev mode, but the production build generated by Vite 8 fails in the browser with the following runtime error:

Uncaught ReferenceError: init_reactivity_esm_bundler is not defined

In some builds, a similar missing helper may also appear:

Uncaught ReferenceError: init_runtime_core_esm_bundler is not defined

The affected project has a large multi-entry setup, with 44 HTML entry points under apps/.

The issue appears only in the built output. Dev mode works normally.

Affected setup

  • Framework: Vue 3
  • Build tool: Vite 8
  • Bundler: Rolldown, bundled with Vite 8
  • Rolldown versions observed: 1.0.2 / 1.0.3
  • Project type: multi-page application
  • Number of HTML entries: 44
  • Package manager: pnpm
  • Vue plugin: @vitejs/[email protected]

What happens

After running the production build and deploying or previewing the generated output, the browser console reports:

Uncaught ReferenceError: init_reactivity_esm_bundler is not defined

The page then stops loading.

Inspecting the generated chunks shows that some chunks, such as component chunks or Pinia store related chunks, contain calls like:

init_reactivity_esm_bundler()

or:

init_runtime_core_esm_bundler()

However, the corresponding function definitions or cross-chunk imports are missing from the generated output.

This seems to happen around the circular ESM dependency chain between Vue packages such as:

@vue/reactivity <-> @vue/runtime-core

Expected behavior

The production build should correctly preserve or import the generated initialization helpers across chunks.

The built application should load successfully in the browser, the same way it does in dev mode.

Actual behavior

The generated production output references helper functions such as:

init_reactivity_esm_bundler
init_runtime_core_esm_bundler

but the helpers are not defined in the relevant chunk scope and are not imported from another chunk.

This causes a runtime ReferenceError and prevents the page from loading.

Reproduction characteristics

The issue occurs with the following combination:

  1. Vite 8 using Rolldown
  2. Vue 3
  3. Multi-entry build with many HTML entries
  4. Vue package circular dependency involving reactivity and runtime-core
  5. Split chunks containing Vue components and/or Pinia stores

A simplified structure looks like:

apps/
  entry-a/index.html
  entry-b/index.html
  ...
  entry-44/index.html
src/
  components/
  stores/

Build command:

pnpm build

Then serve or deploy the dist output and open one of the affected pages.

Things already tried

The following changes did not resolve the issue:

  • Adjusting manualChunks
  • Removing custom chunk splitting
  • Upgrading Rolldown from 1.0.2 to 1.0.3
  • Keeping @vitejs/[email protected]

The issue does not appear to be caused by manual chunk configuration.

Workaround

Downgrading / staying on Vite 7 avoids the issue because Vite 7 uses Rollup for production builds.

With the following setup, the production build works correctly:

{
  "vite": "^7.3.3",
  "@vitejs/plugin-vue": "6.0.7"
}

Rollup correctly handles the circular ESM module initialization across chunks in this case.

Because Vite 7 uses esbuild, the pnpm workspace configuration also needs to allow esbuild builds:

allowBuilds:
  esbuild: true

Why this seems related to Vite 8 / Rolldown

The same application works in:

  • Vite dev mode
  • Vite 7 production build with Rollup

But it fails in:

  • Vite 8 production build with Rolldown 1.0.2 / 1.0.3

The generated output contains calls to initialization helpers that are not defined or imported, which looks like a Rolldown code generation issue for circular ESM dependencies across chunks.

Suggested validation

After building, grep the generated dist files for orphaned helper calls:

grep -R "init_.*_esm_bundler" dist

Affected builds contain calls such as:

init_reactivity_esm_bundler()
init_runtime_core_esm_bundler()

without corresponding local definitions or imports.

Request

Could you please check whether Vite 8 / Rolldown is currently expected to support this kind of Vue multi-entry build with circular Vue package dependencies?

If this is a Rolldown upstream bug, it would be helpful to know whether it should be tracked in the Vite repository, the Rolldown repository, or both.

Reproduction

no public rep

Steps to reproduce

No response

System Info

System:
    OS: Windows 11 10.0.28000
    CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
    Memory: 7.72 GB / 15.76 GB
  Binaries:
    Node: 24.16.0 - C:\Program Files\nodejs\node.EXE
    npm: 11.13.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 11.5.0 - C:\Users\kysyuan\AppData\Local\pnpm\bin\pnpm.CMD
  Browsers:
    Chrome: 148.0.7778.181
    Edge: Chromium (148.0.3967.83)
  npmPackages:
    @vitejs/plugin-vue: ^6.0.7 => 6.0.7
    vite: ^7.3.3 => 7.3.3

Used Package Manager

pnpm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions