Skip to content

[Bug]: ReferenceError: __vitePreload is not defined #3983

@zaaack

Description

@zaaack

Reproduction link or steps

dynamic import cause ReferenceError: __vitePreload is not defined error in ssr project

https://github.com/zaaack/react-router-ssr-starter/tree/rolldown-issue

What is expected?

no error

What is actually happening?

ReferenceError: __vitePreload is not defined
source:

  // for issue test
const { createRcpRouter } = await import("../modules/service");

dist:

const { createRcpRouter } = await __vitePreload(async () => {
	const { createRcpRouter: createRcpRouter$1 } = await import("./assets/service-BQNCVzyX.js");
	return { createRcpRouter: createRcpRouter$1 };
}, __VITE_IS_MODERN__ ? __VITE_PRELOAD__ : void 0);

System Info

System:
    OS: Linux 5.15 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 7.53 GB / 11.69 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 22.9.0 - ~/.asdf/installs/nodejs/22.9.0/bin/node
    npm: 10.8.3 - ~/.asdf/plugins/nodejs/shims/npm
    pnpm: 9.6.0 - ~/.local/share/pnpm/pnpm

Any additional comments?

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions