unplugin / unplugin/unplugin-auto-import

Doesn't work with Astro MDX

Open
#293 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.8k
Forks
217
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

This package doesn't work with Astro+MDX integration.

I defined the proper component path and exports in the config. When I Use the auto imports in .astro files or .svelte files, it works well. But in .mdx file, it completely fails.

In reproduction, if you go to /some-page route, it works there. But on / page which is a .mdx file, it doesn't

Reproduction

https://stackblitz.com/edit/github-vsez61?file=package.json,astro.config.mjs,src%2Fpages%2Findex.mdx,src%2Fpages%2Fsome-page.astro&on=stackblitz

System Info
System:
    OS: macOS 13.0.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 229.92 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.17.1 - ~/Library/pnpm/node
    Yarn: 1.22.19 - ~/Library/pnpm/yarn
    npm: 8.15.0 - ~/Library/pnpm/npm
  Browsers:
    Brave Browser: 107.1.45.118
    Chrome: 107.0.5304.110
    Edge: 107.0.1418.42
    Firefox: 104.0.2
    Safari: 16.1
Used Package Manager

pnpm

Validations
  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

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 StackBlitz reproduction, especially package.json, astro.config.mjs, src/pages/index.mdx, and src/pages/some-page.astro, and compare auto-import behavior on the MDX and Astro routes. Done means the configured auto imports work in the MDX page as they already do in the Astro and Svelte files.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.