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
feat: Vue 3 Support #997
Comments
You are absolutely right, thanks for the recommendation. It might not be enough. I will track the vue 3 compatibility work on this issue. |
As expected, the rewiring of the compiler was not enough. This is how we do it in vue 3. It would mean having one vue app per example block. |
For the reasons above vue 3 compatibility means breaking changes in the way we use I suggest we use the "next" branch and the "@next" channel to deliver vue 3 compat. |
I hit a snag last time I tried which is I have to abandon TypeScript completely if I am to adopt vue 3. |
To be fair to TypeScript, that is classic Facebook/React. |
What can we do now? |
Hello @crutch12 I removed all TypeScript from the vue3 branch. I see your point. I was OK with no TypeScript until it is fixed but no tests at all, that's a bummer. Now, we wait. |
@elevatebart Are we still waiting on vuejs/core#1033? You said you would have some time on VueLand, did you manage to have an idea on how to approach this? |
Hello @spaceemotion I found a solution that works and have not delivered it.
If you are documenting your components in the style of vue-styleguidist, you still have options:
I hope this helps. |
Thanks for the tip! I only wanted to use vue-docgen-api anyways so that was perfect timing. I incorporated it into a custom rollup plugin and it worked without any problems 🎉 (.vue files lang=typescript). Will keep you posted while I explore the options/annotations 👍 |
Alright, not sure if I should open up a new issue for this, but I just tried the following and it doesn't pick up the displayName or description (props work fine though): // (do something up here with "typeof component")
/**
* Buttons allow users to perform an action or to navigate to another page.
* They have multiple styles for various needs, and are ideal for calling attention
* to where a user needs to do something in order to move forward in a flow.
*
* @displayName Button
* @group Form Elements
*/
const component = defineComponent({
name: "DsButton",
props: {},
});
export default component; Gives me: {
"displayName": "DsButton",
"exportName": "default",
"description": "",
"tags": {},
"props": [],
"slots": [
{
"name": "default"
}
]
} |
There is an issue common to vue 2 if you assign the output instead of exporting it directly... In the meantime, this should work though. /**
* Buttons allow users to perform an action or to navigate to another page.
* They have multiple styles for various needs, and are ideal for calling attention
* to where a user needs to do something in order to move forward in a flow.
*
* @displayName Button
* @group Form Elements
*/
export default defineComponent({
name: "DsButton",
props: {},
}); |
also valid for vue 3 defineComponent cc #997
Any news on Vue3 support so far? I enjoy using styleguidist way more than storybook for example, but it feels weird starting a new project now with Vue2 only because of that... :/ |
@Keyes thanks for the kind words. I am a bit swamped right now but it's moving. checkout the progress on the Pull Requests marked with the label next major My plan is to support Vue3 in the next major version. I should be starting to work on it in March, for a release at the beginning of summer.
|
Hi @elevatebart |
@elevatebart Thanks! withDefaults indeed working great! Can you maybe assist with this one? |
Should this still work with Vue 2? Or is there a specific version I should target for projects that haven't been updated yet? |
@shadow7412 It is unit-tested with vue2 (still) so everything should work with vue 2 and not vue 3. Do you have any issue with a vue 2 project ? |
I was getting an error that had something to do with vue sfcs. From memory it might have been unable to find @vue/compiler-sfcs... But I won't be able to get the exact errors until I get back to work on Tuesday. |
@elevatebart sorry about the delay. My current error when attempting to build for a Vue 2 project is My vue is at 2.6.14, and vue-styleguidist is at 4.44.18 in case that helps. |
@shadow7412 It should be |
In the npm command, the import, or both? |
Both. The
|
And this is the package I use in docgen, to parse the sfc |
Does that mean it should be listed as a dependency, assuming it was introduced in vue 3 and not backported? |
It should... I hope it is... |
It is |
@elevatebart is it though? This is an excerpt from package.json in `node_modules/vue-styleguidist`
|
I tried npm installing |
First a quick detail about dependencies: Vue-styleguidist depends on vue-docgen-api that depends on @vue/compiler-sfc and @vue/compiler-core. |
Second, can you please try and create a reproduction on a GitHub repo. This is the best way I can help you. |
Sorry about the delay - does this work for you? (Though I ended up with a different error message again... :/) |
@shadow7412 It does work for me, except I do not have a font-awesome pro account. I was able to work around that, but do not get the error you mention about What OS/ version of node/version of npm are you using? |
Also, when using the vue-cli, please use the cli-plugin. There is a lot of weird quirks about using vue-cli and it needs the plugin. See this doc for more info. |
I have a vite-vue3-typescript project |
Same project, same issue. |
Is it work with vue 3 or not? |
Not yet. |
I believe I will be able to add alpha support for vue 3 around the week of July 4th. Expect a new major version (5.0.0-alpha) to be released mid July. Then we shall see ;) |
Compatibility with Vue 3 was achieved without breaking change in 4.46.1 https://github.com/vue-styleguidist/vue-styleguidist/releases/tag/vue-styleguidist%404.46.0 |
I will close this issue now, please open separate issues for bug reports ;) TYTYTY |
To compile vue3 template we have to use @vue/compiler-sfc (because vue-template-compiler is for vue2 only).
vuejs/core#670 (comment)
So we have to replace
parseComponent(...)
fromvue-template-compiler
withparse(...).descriptor
from@vue/compiler-sfc
Here:
vue-styleguidist/packages/vue-styleguidist/src/loaders/utils/parseVue.ts
Line 14 in 69c848b
vue-styleguidist/packages/vue-styleguidist/src/loaders/utils/getScript.ts
Line 7 in daf0432
vue-styleguidist/packages/vue-styleguidist/src/loaders/utils/processComponent.ts
Line 44 in f5b70bf
The text was updated successfully, but these errors were encountered: