Repro: vite 8.3.0 + rolldown 1.2.9 — every dynamic import fails under experimental.bundledDev with __rolldown_runtime__.requestLazy is not a function

vite 8.3.0 + rolldown 1.2.9: every dynamic import fails under experimental.bundledDev

Gists are flat, so the file layout is encoded in the names below. Recreate it as:

package.json
vite.config.js
index.html
src/data.json     <- src__data.json
src/mod.js        <- src__mod.js
src/main.js       <- src__main.js

Then:

npm install
npm run dev

The page shows:

json: FAILED __rolldown_runtime__.requestLazy is not a function | js: FAILED __rolldown_runtime__.requestLazy is not a function

Remove experimental.bundledDev from vite.config.js and both load fine. Add "overrides": { "rolldown": "1.2.6" } to package.json, reinstall, and both load fine with bundledDev still on.

<!doctype html>
<html>
loading…
</body>
</html>
{
"name": "vite8-bundled-dev-dynamic-import",
"private": true,
"type": "module",
"scripts": { "dev": "vite" },
"devDependencies": { "vite": "8.3.0" }
}

{ "hello": "world" }

const out = document.getElementById('out');
const lines = [];
for (const [label, load] of [
['json', () => import('./data.json')],
['js', () => import('./mod.js')],
]) {
try {
const mod = await load();
lines.push(`${label}: ok ${JSON.stringify(mod.default ?? mod.value ?? mod)}`);
} catch (error) {
lines.push(`${label}: FAILED ${error.message}`);
}
}
out.textContent = lines.join(' | ');

export const value = 'from a js module';

import { defineConfig } from 'vite';
export default defineConfig({
experimental: { bundledDev: true },
});
添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论