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

How to load images by URL? #221

Open
adaboese opened this issue Dec 14, 2023 · 0 comments
Open

How to load images by URL? #221

adaboese opened this issue Dec 14, 2023 · 0 comments

Comments

@adaboese
Copy link

adaboese commented Dec 14, 2023

I do not understand documentation section about image bundling. I do not want to bundle images – I want them to load exactly the same way that they do in Remix.

In Remix, I can already get image URLs like this:

import originalityAiResultAfterRewrite from './originality-ai-result-after-rewrite.png';

// `originalityAiResultAfterRewrite` is image URL

I found one way... but it is very cumbersome:

import originalityAiResultAfterRewrite from './originality-ai-result-after-rewrite.png';
import originalityAiResultBeforeRewrite from './originality-ai-result-before-rewrite.png';

const { code, frontmatter } = await bundleMDX({
    files: {
      originalityAiResultAfterRewrite: `export default '${originalityAiResultAfterRewrite}'`,
      originalityAiResultBeforeRewrite: `export default '${originalityAiResultBeforeRewrite}'`,
    },
    source,
});

and then inside mdx I need to do again:

import originalityAiResultBeforeRewrite from './originality-ai-result-before-rewrite.png';

![Hello](${originalityAiResultAfterRewrite})

Is there a better way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant