vercel / vercel/next.js

Turbopack import.meta.glob fails for parent-relative patterns in server modules

Open
#95,496 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Module Resolution Route Handlers Turbopack
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/chitwitgit/turbopack-import-meta-glob

To Reproduce
  1. Clone https://github.com/chitwitgit/turbopack-import-meta-glob
  2. Run npm install
  3. Run npm run build — build succeeds
  4. Run npm run start
  5. Visit / and GET /api/hello

Alternatively:

npm run dev
curl http://localhost:3000/api/hello
Current vs. Expected behavior

Expected: import.meta.glob is officially supported by Turbopack in Next.js 16.3 and should follow Vite-compatible importer-relative path semantics.

In this repro:

  • the Server Component page should resolve ./page-modules/*.js to ["page-local-module"]
  • the Server Component page should resolve ../lib/modules/*.js to ["example-module"]
  • the App Route should resolve ./modules/*.js to ["local-module"]
  • the App Route should resolve ../../../lib/modules/*.js to ["example-module"]

/api/hello should return:

{
  "localValues": ["local-module"],
  "parentValues": ["example-module"]
}

The page should render:

  • page-local-values: ["page-local-module"]
  • page-parent-values: ["example-module"]

Actual on Next.js 16.3 canary (16.3.0-canary.78):

  • next build and next dev succeed
  • the local control glob works in both the Server Component page and the App Route
  • the parent-relative glob matches nothing in both places
  • /api/hello returns:
{
  "localValues": ["local-module"],
  "parentValues": []
}
  • the page renders:
    • page-local-values: ["page-local-module"]
    • page-parent-values: []

So this looks specific to parent-directory traversal in server-side import.meta.glob resolution, not a generic import.meta.glob failure.

Provide environment information
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Wed Nov  5 21:34:00 PST 2025; root:xnu-11417.140.69.705.2~1/RELEASE_ARM64_T8132
  Available memory (MB): 24576
  Available CPU cores: 10
Binaries:
  Node: 22.19.0
  npm: 11.17.0
  Yarn: 1.22.22
  pnpm: 10.33.4
Relevant Packages:
  next: 16.3.0-canary.78 // Latest available version is detected (16.3.0-canary.78).
  eslint-config-next: N/A
  react: 19.2.7
  react-dom: 19.2.7
  typescript: N/A
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

Turbopack, Module Resolution, Route Handlers

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local), Vercel (Deployed)

Additional context
  • import.meta.glob is officially supported in Next.js 16.3 (Turbopack only).
  • Vite-compatible semantics allow importer-relative parent traversal.
  • This repro demonstrates the same failure in both a Server Component and an App Route.
  • Related prior work: #92640, #92729.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked turbopack-import-meta-glob reproduction: run npm install, npm run build, and npm run start, then request / and /api/hello, or use npm run dev with curl. Compare parent-relative import.meta.glob behavior in the Server Component page and App Route against the stated arrays and JSON/page output; done means parent traversal resolves the expected example-module values in both modes.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs
Domain
api, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.