Skip to content

Can't resolve '~storybook' #123

@sdailly

Description

@sdailly

Hello,

When i create preview.js file & inject this line import '~/.nuxt-storybook/storybook/preview.js' , i have this error :
ERROR in ./.nuxt-storybook/storybook/preview.js Module not found: Error: Can't resolve '~storybook' in

What is the target of ~storybook ? and why i have this error ?

Here my configuration :

// main?.
const path = require('path');

module.exports = {
    webpackFinal(config, options) {
        config.module.rules.map((rule) => {
            if (rule.test instanceof RegExp && rule.test.test('.scss')) {
                rule.use = [
                    ...rule.use,
                    {
                        loader: require.resolve('sass-resources-loader'),
                        options: {
                            resources: [
                                path.resolve(__dirname, '../assets/css/core/_global.scss'),
                                path.resolve(__dirname, '../assets/css/core/main.scss')
                            ]
                        }
                    }
                ]
                return rule;

            }
            return rule;
        });

        config.resolve.alias = {
            ...config.resolve.alias,
            '@': path.resolve(__dirname, '../')
        }
        return config;
    },
    stories: [
        '../components/**/*.stories.@(ts|js|mdx)',
        '../storybook/**/*.stories.@(ts|js|mdx)',
    ],
    addons: [
        '@storybook/addon-docs',
        '@storybook/preset-scss',

]
}

// preview.js
import Vue from 'vue';
import Color from '@/storybook/colors/Color.vue'
import '~/.nuxt-storybook/storybook/preview.js'

Vue.component('Color', Color);

Thanks for answers.
Have a good day.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions