Skip to content

MDX cannot find relative image path without leading ./ #10641

@tisonkun

Description

@tisonkun

Astro Info

Astro                    v4.5.12
Node                     v21.6.1
System                   macOS (arm64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/tailwind
                         @astrojs/sitemap
                         @astrojs/mdx

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

13:05:42 [ERROR] Cannot find module 'banner.png' imported from '/Users/tison/Brittani/nightsky-blog/src/content/posts/greptimedb-community-report/index.mdx'
  Stack trace:
    at /Users/tison/Brittani/nightsky-blog/src/content/posts/greptimedb-community-report/index.mdx?astroPropagatedAssets
    [...] See full stack trace in the browser, or rerun with --verbose.
![GitHub Banner](./banner.png) works
![GitHub Banner](banner.png) failed

What's the expected result?

Both compiled

Link to Minimal Reproducible Example

https://github.com/tisonkun/repro-astro-gldfcz

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P2: nice to haveNot breaking anything but nice to have (priority)feat: assetsRelated to the Assets feature (scope)pkg: mdxIssues pertaining to `@astrojs/mdx` integration

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions