Mdx-deck: Working with static assets (images) in v3

Created on 18 Jul 2019  路  8Comments  路  Source: jxnblk/mdx-deck

Before I used my images as:

![](images/something.png)

<img src="images/something.png" />

While keeping a top level images folder in my project and that worked fine. With the move to v3 this stopped working. I dug a bit into Gatsby and tried moving my images folder into a static folder, but that did not work.

How can we use static resources, such as images?
Is there still a folder being served?

bug help wanted

Most helpful comment

Can confirm that the import way works but requires a reload of the dev server every time you add an image 馃槥

I published a minimal reproduction repo: https://github.com/HoverBaum/bug-mdx-deck-401

All 8 comments

I'm stuck on this too. I've got about 100 SVGs in the static folder, which works fine with @mdx-deck/gatsby-theme (and v2), but it's not working with v3 and gatsby-theme-mdx-deck.

@HoverBaum looking into this now

@alpinegizmo When using gatsby-theme-mdx-deck, the local static directory in your Gatsby site should still work. Do you have a link to a reproduction?

I'll have to dig into this later, but tested using webpack to import an image with the CLI and that can be used as a workaround for now. The other advantage to using webpack is that it will throw an error when an image is missing, rather than causing a 404 in the browser.

import ace from './images/ace.png'

<img src={ace} />

The webpack workaround appears to have the drawback that I have to restart the dev server every time I add an image. That's unacceptable; any way to make this dynamic?

@alpinegizmo hmm, the restarting sounds like it might be a Gatsby issue, but I'll look into it

Can confirm that the import way works but requires a reload of the dev server every time you add an image 馃槥

I published a minimal reproduction repo: https://github.com/HoverBaum/bug-mdx-deck-401

Also a big breaking change for me that prevents me from updating.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

broccolini picture broccolini  路  4Comments

jxnblk picture jxnblk  路  4Comments

dance2die picture dance2die  路  5Comments

busypeoples picture busypeoples  路  4Comments

codepunkt picture codepunkt  路  5Comments