Coder Social home page Coder Social logo

Comments (8)

tfoxy avatar tfoxy commented on April 28, 2024 2

Hi everyone! This happens because Storybook 8 doesn't add framework-specific plugins to Vite. This is mentioned in https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#framework-specific-vite-plugins-have-to-be-explicitly-added

You can create vite.config.js

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";

export default defineConfig({
  plugins: [vue()],
});

or you can add the plugin in viteFinal as mentioned by @shoeyn. The difference is that the vite.config.js can also be used by vitest or to build a library. So viteFinal can be used as configuration that only applies to Storybook specifically.

from storybook.

shoeyn avatar shoeyn commented on April 28, 2024 2

It was a fresh install for me and I couldn't find any information on the matter in the docs as I didn't think to check the migration docs for a fresh install.
So I don't know whether a note in the docs for vite stating on projects with non-standard named vite config files will require the framework specific plugins to be registered in a standard named config file or merged in the manner I specified.

from storybook.

shoeyn avatar shoeyn commented on April 28, 2024 1

Had similar issue with project which has a differently named vite.config.js.
Because of this it doesn't merge the configuration to include the vite vue plugin.
In the .storybook/main.js|ts you need to add:

import vue from '@vitejs/plugin-vue'

const config: StorybookConfig = {
  ...,
  async viteFinal(config) {
    // Merge custom configuration into the default config
    const { mergeConfig } = await import('vite');

    return mergeConfig(config, {
      plugins: [vue()],
    });
  },
}

from storybook.

vanessayuenn avatar vanessayuenn commented on April 28, 2024

Hi, thanks for reporting this. do you have a reproduction repo you can share? If not, can you please create one via storybook.new? We prioritize bug reports that have reproduction. Thank you! 🙏

from storybook.

Archetipo95 avatar Archetipo95 commented on April 28, 2024

Here it is!
This is a Pull request with the updated Storybook v8: Archetipo95/my-nuxt-starter#95
And on main branch you can find my Nuxt starter with working Storybook v7: https://github.com/Archetipo95/my-nuxt-starter

This is the Storybook v7 deploy: https://my-nuxt-starter-storybook.netlify.app/

from storybook.

Archetipo95 avatar Archetipo95 commented on April 28, 2024

Yep I can confirm. I was just going to write the same fix @shoeyn suggested

from storybook.

tfoxy avatar tfoxy commented on April 28, 2024

Oh yeah, it should be mentioned somewhere in the docs (e.g. https://storybook.js.org/docs/get-started/vue3-vite#troubleshooting). And also for the other frameworks.

from storybook.

kasperpeulen avatar kasperpeulen commented on April 28, 2024

cc @kylegach for the docs

from storybook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.