Skip to content

Cannot use query parameters in Vite import.meta.glob #2657

@joshpensky

Description

@joshpensky

Initial checklist

Affected package

@mdx-js/[email protected]

Steps to reproduce

https://github.com/joshpensky/mdx-js-rollup-vite-glob-repro

  1. Create a new Vite 7 project with @mdx-js/[email protected]
  2. Define your vite.config.ts file with the mdx plugin
  3. Create a few mdx files, then import with a raw query:
const docs = import.meta.glob("./docs/*.mdx", {
  query: "?raw",
  import: "default",
  eager: true,
});

Actual behavior

The object values in the returned glob object are function components

Expected behavior

The object values should be the raw strings, which is typical behavior for the ?raw query param in Vite

Runtime

[email protected]

Package manager

[email protected]

Operating system

macOS Sequoia 15.3.2

Build and bundle tools

Vite

Metadata

Metadata

Assignees

No one assigned

    Labels

    🤞 phase/openPost is being triaged manually

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions