Skip to content

Layout groups causing import.meta.glob to fail to find files #6239

@hyyyper

Description

@hyyyper

Describe the bug

This code does not returning anything when inside a layout group:

export async function GET() {
    const glob = import.meta.glob("../**/*.md")
    console.log("(web) glob...")
    console.log(glob)

    return new Response(JSON.stringify({ glob: Object.keys(glob) }))
}

In the repro, I made two routes that do the exact same thing...
(web)/blog/posts.json/+server.js
/it-works/blog/posts.json/+server.js

But it only works outside of the (web) layout group. 🤔

Reproduction

https://github.com/hyyyper/sveltekit-glob-repro

Logs

(web) glob...
{}

/it-works glob...
{ '../sample-post/+page.md': [Function: ../sample-post/+page.md] }

System Info

System:
    OS: Linux 5.15 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (16) x64 AMD EPYC 7B13
    Memory: 42.47 GB / 62.80 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 16.17.0 - ~/.nvm/versions/node/v16.17.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.17.0/bin/yarn
    npm: 8.15.0 - ~/.nvm/versions/node/v16.17.0/bin/npm
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.66 
    @sveltejs/kit: next => 1.0.0-next.435 
    svelte: ^3.44.0 => 3.49.0 
    vite: ^3.0.4 => 3.0.9

Severity

blocking an upgrade

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp1-importantSvelteKit cannot be used by a large number of people, basic functionality is missing, etc.vite

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions