You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[v3] Using nitro/vite with cloudflare preset fails to start #3637
// package.json
{
"name": "cloudflare-bug",
"version": "1.0.0",
"type": "module",
"scripts": {
"build": "vite build",
"preview": "vite preview",
"dev": "vite dev"
},
"devDependencies": {
"@tailwindcss/vite": "^4.1.14",
// I tried using npm:nitro-nightly@beta as it is in the playground but it fails with:// error: Package "nitro-nightly" with tag "beta" not found, but package exists"nitro": "npm:nitro-nightly@latest",
"tailwindcss": "^4.1.14",
"vite": "^7.1.8",
"wrangler": "^4.42.1"
}
}
In v3, when using the cloudflare_module preset in dev mode, the server fails to start with the following error:
Error: Failed to load url /project/workspace/node_modules/nitro/dist/runtime/plugin.dev (resolved id: /project/workspace/node_modules/nitro/dist/runtime/plugin.dev) in virtual:. Does the file exist?
@franklin-tina@pi0 Is yours intact? I have the same problem. I can use vite build without any problems, but vite dev cannot run.
Error: Failed to load url /Users/seven/workspace/panews-server/universal/node_modules/nitro/dist/runtime/plugin.dev (resolved id: /Users/seven/workspace/panews-server/universal/node_modules/nitro/dist/runtime/plugin.dev) in virtual:. Does the file exist?
at loadAndTransform (file:///Users/seven/workspace/panews-server/universal/node_modules/vite/dist/node/chunks/dep-Chhhsdoe.js:26136:33) {
code: 'ERR_LOAD_URL',
runnerError: Error: RunnerError
at reviveInvokeError (file:///Users/seven/workspace/panews-server/universal/node_modules/vite/dist/node/module-runner.js:474:64)
at Object.invoke (file:///Users/seven/workspace/panews-server/universal/node_modules/vite/dist/node/module-runner.js:547:11)
at ModuleRunner.getModuleInformation (file:///Users/seven/workspace/panews-server/universal/node_modules/vite/dist/node/module-runner.js:1053:7)
at request (file:///Users/seven/workspace/panews-server/universal/node_modules/vite/dist/node/module-runner.js:1070:83)
at /Users/seven/workspace/panews-server/universal/plugins/virtual::2:3
at ESModulesEvaluator.runInlinedModule (file:///Users/seven/workspace/panews-server/universal/node_modules/vite/dist/node/module-runner.js:906:3)
at ModuleRunner.directRequest (file:///Users/seven/workspace/panews-server/universal/node_modules/vite/dist/node/module-runner.js:1113:59)
at ModuleRunner.cachedRequest (file:///Users/seven/workspace/panews-server/universal/node_modules/vite/dist/node/module-runner.js:1031:73)
at /Users/seven/workspace/panews-server/universal/node_modules/nitro/dist/runtime/internal/app.mjs:5:1
at ESModulesEvaluator.runInlinedModule (file:///Users/seven/workspace/panews-server/universal/node_modules/vite/dist/node/module-runner.js:906:3)
}
@franklin-tina Then I spent over four hours downgrading to nitro v2. 😂
Sorry about that 🫂
For my case, I was doing a POC demo that I needed v3 for... hence why I said it wasn't super important.
I still use v2 (via Nuxt) with no issues.
Nitro v3 is (pre)alpha state for now, and this issue is specific to cloudflare dev emulation (you can only set preset for production builds).
Commit the above solved issue when trying in a monorepo but a reliable reproduction could be really helpful.
I'll try to see if I can get more info on this.
However, I updated the codesandbox with the latest changes v3.0.0-20251009-155627-a7e0f55d and it still fails.
And you're right, when I run the build command, and start it with npx wrangler --cwd .output/ dev the build doesn't break.
@medz Will need your help too if you can reproduce this.
I think it will be easier for Pooya then
Activity
pi0 commentedon Oct 9, 2025
Should be solved by a85ebaa
fix(cloudflare): update local dev plugin (resolves nitrojs#3637)
franklin-tina commentedon Oct 9, 2025
Thanks @pi0 💚
medz commentedon Oct 9, 2025
@franklin-tina @pi0 Is yours intact? I have the same problem. I can use
vite buildwithout any problems, butvite devcannot run.medz commentedon Oct 9, 2025
franklin-tina commentedon Oct 9, 2025
@medz Not quite, I still get the error.
[email protected]I might just wait a bit more (fortunately, it's not super urgent for me)
medz commentedon Oct 9, 2025
@franklin-tina Then I spent over four hours downgrading to nitro v2. 😂
franklin-tina commentedon Oct 9, 2025
Sorry about that 🫂
For my case, I was doing a POC demo that I needed v3 for... hence why I said it wasn't super important.
I still use v2 (via Nuxt) with no issues.
pi0 commentedon Oct 9, 2025
Nitro v3 is (pre)alpha state for now, and this issue is specific to cloudflare dev emulation (you can only set
presetfor production builds).Commit the above solved issue when trying in a monorepo but a reliable reproduction could be really helpful.
franklin-tina commentedon Oct 9, 2025
I'll try to see if I can get more info on this.
However, I updated the
codesandboxwith the latest changesv3.0.0-20251009-155627-a7e0f55dand it still fails.And you're right, when I run the build command, and start it with
npx wrangler --cwd .output/ devthe build doesn't break.@medz Will need your help too if you can reproduce this.
I think it will be easier for Pooya then
medz commentedon Oct 12, 2025
Change the preset to
cloudflare-module, And runvite devmedz commentedon Oct 12, 2025
Or
{ "name": "nitro-app", "private": true, "scripts": { "build": "nitro build", "dev": "nitro dev", "preview": "npx srvx --prod .output/" }, "devDependencies": { "nitro": "latest" } }medz commentedon Oct 12, 2025
@pi0 @franklin-tina
I fixed:
This is the essence of the problem: https://github.com/nitrojs/nitro/blob/main/src/presets/cloudflare/dev.ts#L81
I wrote a simple resolveId vite plugin to modify it to the correct file address.
franklin-tina commentedon Oct 12, 2025
Here is what I did (In the nitro repo), and it seems to run the playground without failing.
Note
I haven't fully tested this, since I'm still trying out other solutions 🙈
cc @pi0 @medz
In
src/presets/cloudflare/dev.tsIn
src/presets/cloudflare/runtime/plugin.dev.ts:pi0 commentedon Oct 13, 2025
Ah thanks we had another regression. 3afbc40 should fix it
fix(cloudflare): properly resolve dev plugin
franklin-tina commentedon Oct 13, 2025
Thanks @pi0 @medz
I can confirm the issue no longer persists (
Nitro version 3.0.1-20251013-093643-3afbc402)medz commentedon Oct 13, 2025
Great! Once this fix is released into a future version, I can delete the following code.