-
-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: import or require() statements can be added only by editing a Markdown example file #421
Comments
Have you tried, stopping and restarting styleguidist? This being said, I just added an example where I test this exact feature. Would it be possible for you to share a repo where you reproduce this issue? |
I have the same problem since updating to 3.11.0, which contains an update of the react-styleguidist dependency to 9.0.4. Our problem seems to be related to this issue, and the root cause seems to be this npm bug, see this comment. In short, the npm bug results in a wrongly hoisted acorn peer dependency. There seem to be some workarounds that are mentioned in the links and that you may want to try out, involving manually installing a specific acorn version in the root package.json or simply using yarn instead of npm. |
I believe if you delete your package-lock.json and you node_modules folder, then re-install the whole thing can fix it. |
Hi! Thanks for the answers. I tried these:
package-lock and node_modules deleted in each case. None of these helped. The problem still exists. My project is based on VueDS.com boilerplate-project. Original: +-- eslint@4.19.1
| `-- espree@3.5.4
| +-- acorn@5.7.3
| `-- acorn-jsx@3.0.1
| `-- acorn@3.3.0
`-- jest@23.6.0
`-- jest-cli@23.6.0
`-- jest-environment-jsdom@23.4.0
`-- jsdom@11.12.0
+-- acorn@5.7.3 deduped
`-- acorn-globals@4.3.0
`-- acorn@6.0.2 After jest and eslint update: +-- eslint@5.16.0
| `-- espree@5.0.1
| `-- acorn@6.1.1
`-- jest@24.8.0
`-- jest-cli@24.8.0
`-- jest-config@24.8.0
`-- jest-environment-jsdom@24.8.0
`-- jsdom@11.12.0
+-- acorn@5.7.3
`-- acorn-globals@4.3.2
`-- acorn@6.1.1 After acorn@6.1.1 update: +-- acorn@6.1.1
+-- eslint@4.19.1
| `-- espree@3.5.4
| +-- acorn@5.7.3
| `-- acorn-jsx@3.0.1
| `-- acorn@3.3.0
+-- jest@23.6.0
| `-- jest-cli@23.6.0
| `-- jest-environment-jsdom@23.4.0
| `-- jsdom@11.12.0
| +-- acorn@5.7.3
| `-- acorn-globals@4.3.2
| `-- acorn@6.1.1 deduped
+-- vue-styleguidist@3.13.5
| +-- acorn@6.1.1 deduped
| +-- buble@0.19.7
| | `-- acorn@6.1.1
| +-- react-styleguidist@9.1.2
| | `-- acorn@6.1.1
| `-- vue-docgen-api@3.13.5
| `-- pug@2.0.3
| +-- pug-code-gen@2.0.1
| | `-- with@5.1.1
| | +-- acorn@3.3.0
| | `-- acorn-globals@3.1.0
| | `-- acorn@4.0.13
| `-- pug-lexer@4.0.0
| `-- is-expression@3.0.0
| `-- acorn@4.0.13
+-- webpack@4.32.2
| `-- acorn@6.1.1 deduped
`-- webpack-bundle-analyzer@3.3.2
`-- acorn@6.1.1 |
Would you mind sharing your package.json?
Bart Ledoux
Twitter: @bartledoux
Github, Gitter, Discord: @elevatebart
… On May 23, 2019, at 00:57, Mikko Lehtinen ***@***.***> wrote:
Hi! Thanks for the answers. I tried these:
deleted package-lock.json and re-install
updated eslint and jest which were using older acorn version
updated ***@***.*** to my package.json
package-lock and node_modules deleted in each case. None of these helped. The problem still exists.
My project is based on VueDS.com boilerplate-project.
Original:
+-- ***@***.***
| `-- ***@***.***
| +-- ***@***.***
| `-- ***@***.***
| `-- ***@***.***
`-- ***@***.***
`-- ***@***.***
`-- ***@***.***
`-- ***@***.***
+-- ***@***.*** deduped
`-- ***@***.***
`-- ***@***.***
After jest and eslint update:
+-- ***@***.***
| `-- ***@***.***
| `-- ***@***.***
`-- ***@***.***
`-- ***@***.***
`-- ***@***.***
`-- ***@***.***
`-- ***@***.***
+-- ***@***.***
`-- ***@***.***
`-- ***@***.***
After ***@***.*** update:
+-- ***@***.***
+-- ***@***.***
| `-- ***@***.***
| +-- ***@***.***
| `-- ***@***.***
| `-- ***@***.***
+-- ***@***.***
| `-- ***@***.***
| `-- ***@***.***
| `-- ***@***.***
| +-- ***@***.***
| `-- ***@***.***
| `-- ***@***.*** deduped
+-- ***@***.***
| +-- ***@***.*** deduped
| +-- ***@***.***
| | `-- ***@***.***
| +-- ***@***.***
| | `-- ***@***.***
| `-- ***@***.***
| `-- ***@***.***
| +-- ***@***.***
| | `-- ***@***.***
| | +-- ***@***.***
| | `-- ***@***.***
| | `-- ***@***.***
| `-- ***@***.***
| `-- ***@***.***
| `-- ***@***.***
+-- ***@***.***
| `-- ***@***.*** deduped
`-- ***@***.***
`-- ***@***.***
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I also have the exact same issue. Anything after version 3.10.2. |
@RyanHavoc Would you mind setting up a minimum reproduction repo and put the link here. Bart |
@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 If I remove the |
I found the issue and it was easy to fix ;) |
@elevatebart Great! When will the fix be released? |
@elevatebart Hmm... tried updating the file you changed locally for me and now I get this error on the command line when trying to start the styleguide: Same repo... |
This is to be expected. From the ReadMe file, AppButton.vue can't be found. You could replace it by According to the doc, all components are loaded by default unless you use the magic option to only load the local one. |
This const Vue = require('vue').default
const AppButton = require('AppButton').default
Vue.component('AppButton', Button)
<Card>
<AppButton />
</Card> becomes this const AppButton = require('./AppButton').default
Vue.component('AppButton', AppButton)
<Card>
<AppButton />
</Card> should be this <Card>
<AppButton />
</Card> |
This is in opposition to the documentation though? And If I just have:
I the readme, the button doesn't render: |
You are absolutely right I need to update this recipe of the cookbook. |
@elevatebart I'm afraid not. This is what I see: |
Good point, I forgot about the hiding of components. |
I created a new PR for it: |
Great. Thanks for you time on this. Any idea when this will be merged and available as a new version? |
Tonite is bae’s b-day so probably tomorrow
Bart Ledoux
Twitter: @bartledoux
Github, Gitter, Discord: @elevatebart
… On May 23, 2019, at 17:03, Ryan Taylor ***@***.***> wrote:
Great. Thanks for you time on this. Any idea when this will be merged and available as a new version?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Nice! Thank you guys! |
@elevatebart What timezone are you in? Just wondering if there's an ETA on the merge. |
Chicago is CT, merge is incomming |
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:
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.
The text was updated successfully, but these errors were encountered: