question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nuxt 3 component witdh storybook no components found

See original GitHub issue

[unplugin-vue-components] no components found

const path = require('path')
const Components = require('unplugin-vue-components/vite')
const AutoImport = require('unplugin-auto-import/vite')
const { loadConfigFromFile, mergeConfig } = require('vite')


module.exports = {
    stories: [
        '../stories/**/*.stories.mdx',
        '../stories/**/*.stories.ts',
        '../components/**/*.stories.ts',
    ],
    addons: [
        '@storybook/addon-links',
        '@storybook/addon-essentials',
        'storybook-dark-mode',
        {
            name: '@storybook/addon-postcss',
            options: {
                cssLoaderOptions: {
                    importLoaders: 1,
                },
                postcssLoaderOptions: {
                    implementation: require('postcss'),
                }
            }
        }
    ],
    core: {
        builder: 'storybook-builder-vite'
    },
    async viteFinal(config, { configType }) {
        config.plugins = config.plugins ?? []
        config.plugins.push(AutoImport({
            imports: [
                'vue',
                'vue-router',
            ],
            dts: '.nuxt/auto-imports.d.ts',
        }))
        config.plugins.push(Components({
            extensions: ['vue'],
            include: [/\.vue$/, /\.vue\?vue/],
            dts: '.nuxt/components.d.ts',
        }))
        return {
            ...config,
            resolve: {
                alias: {
                    '@': `${path.resolve(__dirname, '..')}/`,
                    '@/': `${path.resolve(__dirname, '..')}/`,
                    'vue': 'vue/dist/vue.esm-bundler.js',
                },
            }
        }
    }
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
productdevbookcommented, Nov 14, 2021
CleanShot 2021-11-14 at 21 18 01@2x

CleanShot 2021-11-14 at 21 18 23

const path = require('path')
const Components = require('unplugin-vue-components/vite')
const AutoImport = require('unplugin-auto-import/vite')
const { loadConfigFromFile, mergeConfig } = require('vite')



module.exports = {
    stories: [
        '../stories/**/*.stories.mdx',
        '../stories/**/*.stories.ts',
    ],
    addons: [
        '@storybook/addon-links',
        '@storybook/addon-essentials',
        'storybook-dark-mode',
        '@storybook/addon-a11y',
        {
            name: '@storybook/addon-postcss',
            options: {
                cssLoaderOptions: {
                    importLoaders: 1,
                },
                postcssLoaderOptions: {
                    implementation: require('postcss'),
                }
            }
        }
    ],
    framework: "@storybook/vue3",
    core: {
        builder: 'storybook-builder-vite'
    },
    async viteFinal(config, { configType }) {
        config.plugins = config.plugins ?? []
        config.plugins.push(AutoImport({
            imports: [
                'vue',
                'vue-router',
            ],
            dts: '.storybook/auto-imports.d.ts',
        }))
        config.plugins.push(Components({
            dirs: ['components'],
            directoryAsNamespace: true,
            dts: '.storybook/components.d.ts',
        }))
        return {
            ...config,
            resolve: {
                alias: {
                    ...config.resolve.alias,
                    '@': `${path.resolve(__dirname, '..')}/`,
                    'vue': 'vue/dist/vue.esm-bundler.js',
                },
            }
        }
    }
}

0reactions
productdevbookcommented, Mar 11, 2022

@productdevbook did you find a workaround for this?

No

Read more comments on GitHub >

github_iconTop Results From Across the Web

Storybook / Nuxt 3 with script setup component - Stack Overflow
I'm not using any of those plugins, it's Nuxt (3.0.0) that auto imports stuff. The idea is to do it without touching the...
Read more >
An (almost) comprehensive guide on using ... - Medium
A guide on getting Storybook to work with the Nuxt.js framework.
Read more >
Importing and Using Components in Nuxt 3 - Server Side Up
When migrating from Nuxt 2 to Nuxt 3, components are now imported and used through auto imports instead of explicit importing.
Read more >
Wire in data - Storybook Tutorials
Wire in data. Learn how to wire in data to your UI component. So far, we have created isolated stateless components-–great for Storybook,...
Read more >
Document & Test Vue 3 Components With Storybook
Storybook is my tool of choice for UI component documentation. ... Unfortunately, I found no way to add JSDoc comments to the counter-update ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found