-
Notifications
You must be signed in to change notification settings - Fork 22
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
Unable to run with storybook #179
Comments
Vuetify components seems to be loaded without defaults, I'm checking if there is a problem with vuetify post plugin in this module and storybook. FYI: I don't see any page using any Vuetify component in https://github.com/storybook-vue/storybook-nuxt-starter |
I don't know why This module enables treeshaking feature via vuetify vite plugin (there is no way to use all components, you need to add them to |
Of course, here is the direct link to component: And Story: Only these files, pages folder looks like boilerplate |
The i18n module seems to be fine, so the problem should be in storebook: it seems it is building the project but I have no idea what's doing behind the scenes: the vuetify vite plugin is registered manually by this module and injects the vuetify imports parsing the vue file in the vite plugins pipeline. EDIT: you cannot register the vuetify vite plugin in your nuxt config file, this module will throw an error if it is found. |
It is about global components: check this entry https://vuetifyjs.com/en/features/treeshaking/ |
No, it seems vuetify vite plugin missing from vite plugins. |
Ok, thank you for your answers, I'll move on with investigation in storybook ❤️ |
This plugin should add the imports (a copy/paste from the original): https://github.com/userquin/vuetify-nuxt-module/blob/main/src/vite/vuetify-import-plugin.ts#L25-L49 I'm going to check if being called when running First time I use storybook ;) |
Me too, honestly. Part of big Nuxt2/3 migration Edit: They have |
Anyway, there is no entry for Nuxt 3 in the docs, with nuxt modules you can do a lot of things, you have layers, you have module hooks (communication between modules), storybook cannot use only vite, Nuxt 3 is built on top of Nitro and Vite |
It seems we need to patch or use another plugin, the plugin being called but storybook maybe adding some vite plugin to transform vue files. |
why building to request raw file? |
ok, found the problem: https://github.com/storybook-vue/storybook-nuxt/blob/main/packages/storybook-nuxt/src/preset.ts#L95C26-L97 calling with raw vue file since it is moving all plugins before vue |
Oh, I was near, but moved into main storybook repo. We can modify vite config back by using viteFinal inside import type { StorybookConfig } from "@storybook-vue/nuxt";
import {ViteConfig} from "@nuxt/schema";
const config: StorybookConfig = {
stories: [
"../stories/**/*.mdx",
"../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)",
],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
],
framework: {
name: "@storybook-vue/nuxt",
options: {},
},
docs: {
autodocs: "tag",
},
viteFinal: (config: ViteConfig) => {
console.log(config.plugins?.map(p => p.name));
return config
}
};
export default config; |
No, it is better to use an object notation for the transform hook using enforce/order 'post': I'm testing in my local... EDIT: cannot use object notation (it is not |
I'm going to update the repo to |
tried too, unluko |
The pages and components being rendered before vuetify is created providing the defaults ( |
But AFAIK, all plugins runs before components rendering 🫨 |
Tried also using defineAsyncComponent, no luck, same error (removing const Vuetify = defineAsyncComponent({
loader: () => import('~/components/vuetify/index.vue').then(m => m.default ?? m),
loadingComponent: () => h('div', 'loading...'),
onError(error, retry, fail, attempts) {
console.error('Vuetify::error', error)
},
})
const VuetifyWithImports = defineAsyncComponent({
loader: () => import('~/components/vuetify/withImports.vue').then(m => m.default ?? m),
loadingComponent: () => h('div', 'loading...'),
onError(error, retry, fail, attempts) {
console.error('VuetifyWithImports::error', error)
},
}) |
The example using vuetify in storybook not working, in fact, not working even in dev server with latest vuetify, vite and storybook versions: https://github.com/storybookjs/vue3-code-examples |
@AndreyYolkin using the deprecated vuetify module working with latest vuetify, nuxt, vite and storybook versions? |
Will try tomorrow, not sure, because it was released even before vuetify 3.4 and nuxt 3.7. Sorry, another timezone |
Meanwhile, the deprecated module (OTP was introduced in 3.4): https://github.com/AndreyYolkin/storybook-vuetify-issue/tree/invictus |
I have released @storybook-vue/nuxt 0.2.1 with patch fixing this issue,. if it did not work for you please create a repro repo for me. i will check it out |
Glad you joined us! I've updated the repo's deps to the latest version, but problem still exists. Please, check the main branch at https://github.com/AndreyYolkin/storybook-vuetify-issue |
Hi, @AndreyYolkin , did you found stable working solution for vuetify-nux-module + storybook ?? |
Hi, I ended up with writing own "storybook". I's not so hard, especially if you don't want to automatically get information about slots |
It seems we have the same issue with Histoire... |
@nuxtjs/storybook v8.0.0 propably fix this issue |
Of which library? |
@nuxtjs/storybook v8.0.0 |
I came across with this issue and the problem still persist. I don't know wether my problem is related with this issue, but I am using Nuxt 3 with Vuetify 3 and Storybook (@nuxtjs/storybook) and I am having the following error:
I think it is because of Any help would be appreciated 🙌🏻 |
I tried to work on this at nuxt-modules/storybook#614 but got stuck (see PR description there). Would appreciate if someone could take over from here, as I'm not using vuetify myself. |
My setup:
Darwin
v20.5.0
3.9.0
3.10.0
2.8.1
pnpm@8.10.5
-
modules
,i18n
,devtools
@nuxtjs/i18n@8.0.0
,vuetify-nuxt-module@0.8.0
-
Reproduction
https://github.com/AndreyYolkin/storybook-vuetify-issue
Description
Thank you for your titanic work on building this module. I've tried to add storybook into my project, but for some reasons vuetify works in dev mode and have some problems inside storybook. Please follow the readme to get the error in reproduction.
Additional details
Vuetify not working storybook-vue/storybook-nuxt#42 (comment)
The text was updated successfully, but these errors were encountered: