Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 task
tisonkun opened this issue Apr 2, 2024 · 4 comments · Fixed by #10754
Closed
1 task

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

tisonkun opened this issue Apr 2, 2024 · 4 comments · Fixed by #10754
Labels
- P2: nice to have Not breaking anything but nice to have (priority) feat: assets Related to the Assets feature (scope) pkg: mdx Issues pertaining to `@astrojs/mdx` integration

Comments

@tisonkun
Copy link

tisonkun commented Apr 2, 2024

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.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Apr 2, 2024
@OliverSpeir OliverSpeir added - P2: nice to have Not breaking anything but nice to have (priority) and removed needs triage Issue needs to be triaged labels Apr 2, 2024
@OliverSpeir
Copy link
Contributor

Thanks for bringing this up! Recently added this functionality to markdown but not mdx, definitely would like to see this work in mdx as well.

@Princesseuh Princesseuh added pkg: mdx Issues pertaining to `@astrojs/mdx` integration feat: assets Related to the Assets feature (scope) labels Apr 2, 2024
@rishi-raj-jain
Copy link
Contributor

@OliverSpeir

Possible to a link a PR to the markdown contribution enabling this? I'm happy to try it out for mdx.

@OliverSpeir
Copy link
Contributor

@rishi-raj-jain

The md code

The mdx code

basically just adding the ./ if the path isn’t already relative

@rishi-raj-jain
Copy link
Contributor

Thank you for the references, I've created the PR after testing the changes locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: nice to have Not breaking anything but nice to have (priority) feat: assets Related to the Assets feature (scope) pkg: mdx Issues pertaining to `@astrojs/mdx` integration
Projects
None yet
4 participants