Skip to content

Reference Error: __rolldown_runtime__ is not defined with bundledDev: true -- when importing an in-monorepo library and htat library's dependencies are specified in optimizeDeps.include (but not the library itself) #563

@NullVoxPopuli

Description

@NullVoxPopuli

Describe the bug

When I try to use bundledDev: true, I get an error that prevents my app from booting:

debug-BpoEGvGA.js:14 Uncaught ReferenceError: __rolldown_runtime__ is not defined
    at debug-BpoEGvGA.js:14:28
Image

Reproduction

https://github.com/NullVoxPopuli/repro-vite-rolldown-bundledDev-error-with-__rolldown_runtime__
( this is a paired down fork of https://limber.glimdown.com/ )

Steps to reproduce

  • clone the repro
  • cd into repro
  • have node 24 and pnpm 10.25
  • pnpm i
  • pnpm build
  • cd apps/repl
  • pnpm start (alias for vite --port 4201)
  • visit https://localhost:4201
  • observe error

NOTE: i'm still exploring what changes are needed for ember to provide the best rolldown/vite8 experience possible, so apologies for the mess in my vite.config <3

I'm still working on minimizing the library side of this repro, but the app reproduction is simply a single import, doesn't matter if it's used or not:

// in apps/repl/app/app.gts
import { getCompiler } from 'ember-repl';

I have a feeling this may have something to do with
packages/ember-repl/src/services/known-modules.ts -- as when I delete it (and all references) I can no longer reproduce the error) -- there are a lot of dynamic imports in here. I've moved this file to packages/ember-repl/src/index.ts for more direct reference.

I've been able to pair down these dynamic imports to just:

export const emberCompilationModules = {
  '@ember/template-compiler/runtime': () => import('@ember/template-compiler/runtime'),
  'content-tag': () => import('content-tag'),
};

If I remove either one of them, the error goes away, but having both brings the error.

of note, content-tag contains a wasm file (and has exports conditions for node vs not-node-ESM etc), and @ember/template-compiler/runtime is resolved via another plugin (resolver from @embroider/vite) and points at node_modules/ember-source/dist/packages/@ember/template-compiler/runtime.js

However!!

I don't think this problem is unique to the combination of these two dependencies, as since upgrading to vite8-beta.2, my big multi-million line project at work (which doesn't load content-tag or the runtime template-compiler) has the same issue

System Info

❯ npx envinfo --system --npmPackages '{vite,rolldown-vite,@vitejs/*,rollup,rolldown}' --binaries --browsers
Need to install the following packages:
[email protected]
Ok to proceed? (y) y


  System:
    OS: macOS 15.6.1
    CPU: (16) arm64 Apple M4 Max
    Memory: 11.76 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.12.0 - /Users/psego/.proto/tools/node/24.12.0/bin/node
    Yarn: 4.10.3 - /Users/psego/.proto/shims/yarn
    npm: 11.6.2 - /Users/psego/.proto/tools/node/24.12.0/bin/npm
    pnpm: 10.25.0 - /Users/psego/.proto/shims/pnpm
    bun: 1.3.3 - /Users/psego/.proto/shims/bun
  Browsers:
    Chrome: 143.0.7499.110
    Firefox: 145.0.2
    Safari: 26.1
  npmPackages:
    vite: 8.0.0-beta.2 => 8.0.0-beta.2


(also happens on linux tho)

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