Closed shinodkharim closed 1 year ago
@shinodkharim I've had a look into this and can't replicate the specific issue you have, but there does seem to be issues with Storybook v7 (which is still in beta currently). I'm using storybook@7.0.0-beta.17
and getting different issue which is blocking me from being able to test my package.
Once these are resolved I should be able to test storybook-vue3-router
BUT I expect having read the migration guide that the package as it currently stands will not be compatible so ill need to refactor / fix bugs and then I will release a new major version to function with storybook@7.x
Ill be working on this in my storybook-7
branch: https://github.com/NickMcBurney/storybook-vue3-router/tree/storybook-7 and will update here once new version is published.
Storybook 7 is officially launched tomorrow. I too get this issue, will you be publishing a fix?
X [ERROR] No matching export in "../../node_modules/.pnpm/@storybook+vue3@7.0.0-rc.2_vue@3.2.47/node_modules/@storybook/vue3/dist/index.mjs"
for import "app"
../../node_modules/.pnpm/storybook-vue3-router@2.3.1_hgad37d4lxrjpkyhcxoqulee3i/node_modules/storybook-vue3-router/dist/esm/withMockRout
er.js:7:9:
7 │ import { app } from "@storybook/vue3";
Thanks for linking that issue @blowsie, I have been trying to get decorator working with storybook 7 but with app
export missing I've been unable to. Issue I have is that although I have code which should implement vue-router, the decorator is loaded after component mounts (which throws errors because vue-router not ready).
I'll keep my eye on that issue and hopefully get this working soon.
Hi @NickMcBurney , please see my comments over here... https://github.com/NickMcBurney/storybook-vue3-router/pull/39
Here is my working version with vue3 and vite https://github.com/blowsie/storybook-vue-router/tree/sb-7
@blowsie thanks for your example. I've fixed the issue and migrated to @storybook/vue3-vite.
PR Updated and working: #39
I need to do more testing and publish new version but looking good so far.
Looks like you beat me to it. Good work. Glad I could help a little
@shinodkharim you can try installing this version 3.0.0-next.0
npm i -D storybook-vue3-router@3.0.0-next.0
Once Storybook publishes v7 (non-prerelease) I'll publish v3.0.0 (non-prerelease).
New version published using storybook@7.0.0.rc-8
:
storybook-vue3-router@3.0.0-next.2
Hey @NickMcBurney, we found that using new setup function exported from @storybook/vue3 (sb7) as documented here has an issue, especially for addon authors.
The issue is that the setup function can only be called once... see here https://github.com/storybookjs/storybook/blob/next/code/renderers/vue3/src/render.ts#L19
This means that an addon author is not able to safely use this setup method, since once it is called in the preview.ts in the users storybook, it will break. There are a few workarounds here, but ultimately it leads to inconsistency when using addons and setup in the preview file.
I raised this with the storybook in team, here https://discord.com/channels/486522875931656193/490822288736780288/1090996147620950067
Hopefully we can make a nice workaround to this issue.
Hey @blowsie, thanks for bringing this to my attention.
Do have any examples of the issues caused/weird behaviour? I've not noticed anything when testing myself - but my tests are very simple and not a great representation of real-life uses.
Note to anyone discovering this issue. With storybook-vue3-router@3.0.0-next.2
This import:
import vueRouter from 'storybook-vue3-router'
...must be changed to:
import { vueRouter } from 'storybook-vue3-router'
Another thing to note is that, currently, version 3.0.0-next.2 seems to annihilate other existing Vue plugins making it unusable if you have a custom preview.js
that adds plugins.
I've publish new 3.0.0 version with storybook 7 support. Also readme is updated explaining issue mentioned by @matthew-dean - I had this noted in PR but it must have been missed.
I recently tried to upgrade to storybook7 and Vite but the package is giving this error- _No matching export in "node_modules/@storybook/vue3/dist/index.mjs" from import "app".
Below is my package.json