AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Turbopack Import.Meta.Glob Fails To Resolve Parent-Relative Patterns In Server Modules

import.meta.glob with `../` patterns matches nothing in server components and app routes under Turbopack in Next.js 16.3 canary, while `./` patterns work. This breaks Vite-compatible path semantics for parent traversal.

highConfidence 75%Next.jsApp RouterServer ActionsHydrationAffected V16.3.0-Canary.78

Origin Analysis

Turbopack's import.meta.glob resolver does not correctly normalize parent-relative patterns (`../`) when matching against the importer's directory. The glob resolution likely treats the pattern as relative to the project root instead of the importing file's directory, or fails to expand `..` segments, causing the pattern to match no files when traversing upward.
1. Create a Next.js 16.3 canary project with Turbopack. 2. In a server component or app route, use import.meta.glob with a pattern containing `../` (e.g., `import.meta.glob('../lib/modules/*.js')`). 3. Run `next dev` or `next build && next start`. 4. Observe that the glob returns an empty object/array, while `./` patterns work.

Fixing Code Block

Edge Case Audit

The workaround relies on import.meta.glob supporting root-relative paths; if not fully supported, it may fail or behave differently. Test thoroughly before deploying. The structure change may break if files are moved. For a permanent fix, track the Next.js issue and upgrade once resolved. To rollback, revert the pattern changes.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state