#assets: relative paths in markdown files work in dev, but not in SSG build

11 messages · Page 1 of 1 (latest)

tame charm
#

Hi,

I am trying to use the new assets feature and I have markdown files (which I fetch from a different local repo using Astro.glob) with relative image paths there. These work fine during dev mode, but when I try to make a static build, I get

Error [RollupError]: Failed to parse Markdown file "/Users/matho180/MultiQC/docs/core/development/plots.md":
The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths, received "../MultiQC/docs/images/cbrewer_scales.png".
    at error (file:///Users/matho180/MultiQC_website/node_modules/rollup/dist/es/shared/node-entry.js:2105:30)
    at FileEmitter.emitFile (file:///Users/matho180/MultiQC_website/node_modules/rollup/dist/es/shared/node-entry.js:23804:24)
    at Object.resolveImage (file:///Users/matho180/MultiQC_website/node_modules/astro/dist/vite-plugin-markdown/index.js:55:23)
    at async file:///Users/matho180/MultiQC_website/node_modules/@astrojs/markdown-remark/dist/remark-collect-images.js:16:20 {
  code: 'VALIDATION_ERROR'
}

The relative paths in this error messages are already resolved from ../../images and correct from the perspective of the website repo. Am I doing something wrong or is this a bug?

copper flame
#

As far as I can tell, it's a bug

tame charm
#

should I make an issue for it? It's a bit difficult to generate a minimal working example for it I guess

copper flame
#

An issue would definitely be great! I'll take a look at it either ways, but it's easier to keep track of for sure 😄

tame charm
copper flame
#

cc @mighty phoenix as this seems to be in the code you've written to make this work

copper flame
copper flame
#

Haha, I just meant that you might have some context!

mighty phoenix
#

yeah i can take this one

copper flame
#

fwiw, I've seen this error when trying to achieve that feature myself, the error message is super unclear and Rollup actually expects a stringified URL