Skip to content
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

"Neither (...).vue nor (...).js nor ... could be found in (...)" when rendering component #524

Open
EddyPuggle opened this issue Apr 10, 2024 · 2 comments
Labels
status: needs reproduction Needs a minimal reproduction type: bug Something isn't working

Comments

@EddyPuggle
Copy link

EddyPuggle commented Apr 10, 2024

When accessing the story for a component that imports a ts file that exports the component props type, it generates the following warnings:

[15:51:54]  WARN  Neither '~/components/ExampleComponent/ExampleComponent.vue' nor '~/components/ExampleComponent/ExampleComponent.js(x)' or '~/components/ExampleComponent/ExampleComponent/index.js(x)' or '~/components/ExampleComponent/ExampleComponent/index.ts(x)
' could be found in 'D:/Projects/exampleProject/components/ExampleComponent'

Something to note is, that the story still works as expected. The warning is something that bothers.

@rherwig
Copy link

rherwig commented Apr 10, 2024

My best guess without having seen the project or storybook's main.ts would be that storybook does not pickup on your tsconfig aliases. To test this, switch out the ~ for the relative path.

I used the viteFinal function in the .storybook/main.ts to add paths, just for reference.

import { mergeConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import type { StorybookConfig } from '@storybook/vue3-vite';
import { fileURLToPath } from 'node:url';

const config: StorybookConfig = {
    stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
    addons: [
        '@storybook/addon-links',
        '@storybook/addon-essentials',
        '@chromatic-com/storybook',
        '@storybook/addon-interactions',
    ],
    framework: {
        name: '@storybook/vue3-vite',
        options: {},
    },
    docs: {
        autodocs: 'tag',
    },
    viteFinal(config, { configType }) {
        return mergeConfig(config, {
            plugins: [vue()],

            resolve: {
                alias: [
                    {
                        find: '~',
                        replacement: fileURLToPath(new URL('../src', import.meta.url)),
                    },
                ],
            },
        });
    },
};

export default config;

@tobiasdiez
Copy link
Collaborator

@tobiasdiez tobiasdiez added type: bug Something isn't working status: needs reproduction Needs a minimal reproduction labels Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs reproduction Needs a minimal reproduction type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants