Skip to content

Commit 861a9ae

Browse files
committed
fix(devframe): keep dynamic service import bundler-ignored
Wire services declared by descriptor (`services: [{ package }]`) are loaded through a runtime `import()` of a resolved absolute path. Bundlers that compile devframe's node code — notably a Next.js hub running under Turbopack — tried to statically analyze that fully-dynamic import and failed with "Cannot find module as expression is too dynamic", so every declared service (service-git, service-shiki, service-open) was silently skipped and its agent-flagged RPC never reached the aggregate MCP surface (e.g. the missing `devframes_service_git_status` tool). Mark the import webpack/vite/turbopack-ignored so hosts leave it as a real runtime import, matching how the reference hub loads plugin packages. No effect on the plain Node path (the markers are comments). Created with the help of an agent.
1 parent 47cd0a1 commit 861a9ae

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/devframe/src/node/services-install.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ export async function importServicePackage(
6262
lastError = error
6363
continue
6464
}
65-
return await import(pathToFileURL(resolved).href)
65+
// `resolved` is a runtime-resolved absolute path, so this is a fully
66+
// dynamic import. Mark it bundler-ignored (webpack / turbopack) so hosts
67+
// that bundle devframe's node code — e.g. a Next.js hub — leave it as a
68+
// real runtime import instead of failing with "expression too dynamic".
69+
return await import(/* webpackIgnore: true */ /* @vite-ignore */ /* turbopackIgnore: true */ pathToFileURL(resolved).href)
6670
}
6771
throw lastError
6872
}

0 commit comments

Comments
 (0)