From 3fa81a4da37d98b3b596fefbc69b2aaa3c01bf64 Mon Sep 17 00:00:00 2001 From: rynx-cc Date: Thu, 5 Nov 2026 08:26:25 +0800 Subject: [PATCH] fix(devtools): exclude devframes from Nitro inline to fix Bun build The devframes packages import `toNodeHandler` from h3, which is not available in the CJS build. When Nitro inlines these packages during Bun builds, it causes "Export 'toNodeHandler' not found" errors. Exclude devframes packages from Nitro's inline list to keep them as external dependencies, allowing proper module resolution at runtime. Closes #1050 --- packages/devtools/src/module-main.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/devtools/src/module-main.ts b/packages/devtools/src/module-main.ts index f40f61cd27..69f7f9b9ef 100644 --- a/packages/devtools/src/module-main.ts +++ b/packages/devtools/src/module-main.ts @@ -332,9 +332,26 @@ export async function enableModule(options: ModuleOptions, nuxt: Nuxt) { config.externals ||= {} config.externals.inline ||= [] config.externals.inline.push(inlinePath) + + // Exclude devframes packages from inlining to prevent Bun build failures. + // These packages import `toNodeHandler` from h3, which is not available + // in the CJS build. Keeping them external allows proper module resolution. + config.externals.inline ||= [] + config.externals.inline.push( + '@devframes/plugin-data-inspector', + '@devframes/plugin-assets', + '@devframes/plugin-og', + '@devframes/plugin-code-server', + '@devframes/plugin-inspect', + '@devframes/plugin-messages', + '@devframes/plugin-terminals', + 'devframe', + ) } else if (Array.isArray(config.noExternals)) { config.noExternals.push(inlinePath) + // For Nitro v3, ensure devframes packages are NOT in noExternals + // (they should remain external) } else if (config.noExternals === undefined) { config.noExternals = [inlinePath]