hirotaka / storybook-addon-nuxt

This add-on makes it easier to set up Storybook in your Nuxt3 project.
78 stars 16 forks source link

feature request: add support for `nuxt.config.js|ts`'s `srcDir` option #15

Open miclgael opened 1 year ago

miclgael commented 1 year ago

Hi and thanks for your work so far on this plug-in.

Problem

I keep my core nuxt directories in a src folder in the root of my projects, using the srcDir option in NuxtConfig.

To get storybook-addon-nuxt to work with my setup, I need to include a components folder in the root, with a dummy component. I can get by with this work-around, but it would be great if auto-imports worked with this configuration.

Docs

https://nuxt.com/docs/api/configuration/nuxt-config#srcdir

Screenshot

image

Workaround

<!-- ./components/StorybookAddonNuxtFix.vue -->
<template>
  <h1>:)</h1>
  <!--
    This component is a workaround for a bug in the Nuxt Storybook addon.
    @link: https://github.com/hirotaka/storybook-addon-nuxt/issues/15
  -->
</template>
miclgael commented 1 year ago

Update: another issue with this is that app.config.ts also needs to be duplicated for this module to work.

PS - I'd be happy to make a PR if I could have a little guidance on where in the code I might work on it.

Another workaround

// place in root dir
import config from './src/app.config'

import { defineAppConfig } from 'nuxt/dist/app/nuxt.js'

export default defineAppConfig(config)