From 008f7dfd7ecf0d9a5dfc56507a097bcbd342303d Mon Sep 17 00:00:00 2001 From: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com> Date: Sun, 8 Feb 2026 22:06:51 +0530 Subject: [PATCH] fix(cloudflare): use explicit imports in dev plugin instead of `#imports` The cloudflare dev plugin (`plugin.dev.ts`) imports `useRuntimeConfig` and `getRequestURL` from `#imports`, which is a virtual module that depends on Nitro's auto-import system being enabled. When used with Nuxt's `compatibilityVersion: 5` (which sets `nitroAutoImports: false` by default), the `#imports` virtual module is never created, causing the dev server to fail with: Error: Could not load .nuxt/imports (imported by nitropack/dist/presets/cloudflare/runtime/plugin.dev.mjs): ENOENT: no such file or directory Replace `#imports` with explicit imports from `nitropack/runtime` and `h3`, consistent with how `defineNitroPlugin` is already imported from `nitropack/runtime` in other runtime files. Closes nuxt/nuxt#34282 --- src/presets/cloudflare/runtime/plugin.dev.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/presets/cloudflare/runtime/plugin.dev.ts b/src/presets/cloudflare/runtime/plugin.dev.ts index 022685ff7d..62b44c8140 100644 --- a/src/presets/cloudflare/runtime/plugin.dev.ts +++ b/src/presets/cloudflare/runtime/plugin.dev.ts @@ -1,8 +1,7 @@ -import type { NitroAppPlugin } from "nitropack"; +import type { NitroAppPlugin } from "nitropack/types"; import type { GetPlatformProxyOptions, PlatformProxy } from "wrangler"; - -// @ts-ignore -import { useRuntimeConfig, getRequestURL } from "#imports"; +import { useRuntimeConfig } from "nitropack/runtime"; +import { getRequestURL } from "h3"; const proxy = await _getPlatformProxy().catch((error) => { console.error("Failed to initialize wrangler bindings proxy", error);