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.

Error: import or require() statements can be added only by editing a Markdown example file

See original GitHub issue

Hi!

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:closed
  • Created 4 years ago
  • Comments:23 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
elevatebartcommented, May 23, 2019

I found the issue and it was easy to fix 😉 Thank you @RyanHavoc for setting up the repro

1reaction
RyanHavoccommented, May 23, 2019

@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: image

If I remove the Vue require I get the error everyones talking about here.

image

Read more comments on GitHub >

github_iconTop 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 >

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