Error: import or require() statements can be added only by editing a Markdown example file
See original GitHub issueHi!
I updated vue-styleguidist from 2.1.2 to 3.13.4. After the update requiring json-data for the documentation examples in the markdown does not work. The example below works on 2.1.2 but is broken on 3.13.4. I did not notice any comments related to this in the release-notes.
My markdown looks something like this:
const tableData = require('./tabledata.json')
<div>
<my-fancy-table
:data="tableData" />
</div>
Current behavior
Does not render the component, but it renders an error:
“Error: import or require() statements can be added only by editing a Markdown example file”
Expected behavior
Should render the component with required sample data.
Issue Analytics
- State:
- Created 4 years ago
- Comments:23 (12 by maintainers)
Top Results From Across the Web
import or require() statements can be added only by editing a ...
I'm trying to make an example of my component in the Markdown file (.md). The problem is when I try to import something...
Read more >styleguidist/styleguidist - Gitter
For each component, beside a NameComponent.md file to run the example, ... import or require() statements can be added only by editing a...
Read more >How do I load a markdown file into a react component?
A full working example with react-markdown : import React, { Component } from 'react' import ReactMarkdown from 'react-markdown' import ...
Read more >Troubleshooting MDX
This article goes through several common problems and errors that might occur when using MDX.
Read more >Getting Started | Markdown Guide
Create a Markdown file using a text editor or a dedicated Markdown application. The file should have an .md or .markdown extension. Open...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I found the issue and it was easy to fix 😉 Thank you @RyanHavoc for setting up the repro
@elevatebart Sure. I’ve created this: https://github.com/RyanHavoc/vue-sg
Note the example in the cookbook for accessing components in markdown files: https://vue-styleguidist.github.io/docs/Cookbook.html#how-to-hide-some-components-in-style-guide-but-make-them-available-in-examples
I see this:
If I remove the
Vuerequire I get the error everyones talking about here.