question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot import components inside a markdown file

See original GitHub issue

image

<template>
    <div class="prose prose-lg mx-auto">
        <nuxt-content :document="page" />
    </div>
</template>

<script>
    export default {
        async asyncData ({ $content, params }) {
            const page = await $content(params.slug || 'index').fetch()

            return {
                page
            }
        }
    }
</script>
---
title: Getting started
description: ''
---

<example></example>

Steps to reproduce

  1. Create a component inside the components/ directory.
  2. Try to include the component in a markdown file.

What is Expected?

See the component on the web page when you navigate to the URL.

What is actually happening?

Seeing an error in the console (screenshot attached.)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
benjamincanaccommented, Jul 23, 2020

It seems there is an issue with local components registration in development due to live edit mode.

For now, to solve the issue you can put your components inside components/global/ using Nuxt 2.13+ and setting components: true in your nuxt.config.js, see Vue components > Global components.

You will also be able to disable the live edit feature once #285 is merged.

0reactions
mlazuardycommented, Oct 20, 2020

is this resolved ? in nuxt theme docs it can be override by adding

{
 components: [
//import default components directory and global directory here
    {
      path: 'your custom component dir path',
      global: true
    }
  ]
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I load a markdown file into a react component?
Import App.md and use it in React component. ... Create one type definition (index.d.ts) file in one of the project directory and put...
Read more >
react-markdown - npm
Start using react-markdown in your project by running `npm i ... you instead want to use JavaScript and JSX inside markdown files, use...
Read more >
Getting Started | Markdown Guide
If you decide you don't like the Markdown application you're currently using, you can import your Markdown files into another Markdown application.
Read more >
Imports - Astro Documentation
Astro Components ( .astro ); Markdown ( .md , .markdown , etc.) ... You can import .ts and .tsx files directly in your...
Read more >
Import Markdown Files into Other Markdown Files as React ...
mdx-js enables you to import Markdown files then render them inside of other Markdown files as JSX so you can easily separate files...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found