Skip to content

import.meta.glob paths only #19871

@hyunbinseo

Description

@hyunbinseo

Description

Current Named Imports only supports string or undefined.

I only need the imported paths, not the modules themselves.

Suggested solution

Support import: null:

const modules = import.meta.glob('./dir/*.js', { import: null })

Alternative

No response

Additional context

I am using this feature to get the page listing in a SvelteKit app.

Example: https://hyunbin.cc/poc (source)

This would also be useful for defining SvelteKit pre-render entries.

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions