content icon indicating copy to clipboard operation
content copied to clipboard

Cannot use external content for rendering

Open itpropro opened this issue 1 year ago • 2 comments

Environment

I try to create a simple plugin to display GitHub gists in a code block based on a gist URL. Due to multiple issues with the MDC component inside of a Markdown component and as I need it to already be embedded in the static content, I decided to create a plugin for that. Unfortunately, as soon as there is a async ofetch request in the plugin, the file body is no longer updated. It is probably because of Nitro not supporting async plugins (@pi0 ?).

What is the current recommended way to add external content to your content files. There a many scenarios besides embedding GitHub gist code, where this would be helpful/necessary.

Reproduction

https://stackblitz.com/edit/nuxt-content-repro?file=server%2Fplugins%2Fcontent.ts

Commenting the async call out (line 18-21) makes it work. Also delete the content-cache and cache folder under .nuxt.

Describe the bug

Cannot request external content in content hook.

Additional context

No response

Logs

No response

itpropro avatar Oct 22 '24 17:10 itpropro

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Jan 16 '25 15:01 github-actions[bot]

Any updates @farnabaz ?

itpropro avatar Jan 18 '25 20:01 itpropro