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

Autoimports is not working in tesiting components #679

Open
AndreySergienko opened this issue Jul 9, 2024 · 2 comments
Open

Autoimports is not working in tesiting components #679

AndreySergienko opened this issue Jul 9, 2024 · 2 comments
Labels
status: help wanted Good idea, but the core developers will not work on it at the moment type: bug Something isn't working

Comments

@AndreySergienko
Copy link

Hi!
This my first issue :)

I have a problem with integration storybook 8+ and nuxt 3.11+, auto imports is not working in testing components.

Example TestingComponent.vue:

import { ref } from 'vue';
import VInput from '@/components/VInput';

If component are using any instrument vue(ref, reactive, ..) or any components/composables/utils without precise import, then storybook has reject, requiring to add an import.

My step:

  1. Integrate storybook module https://nuxt.com/modules/storybook and install npm i storybook-addon-nuxt
    1.1 Integrate storybook without module - there are no differences
  2. Create config

My config .storybook/main.ts:


import { StorybookConfig } from "@storybook/vue3-vite";
import vue from "@vitejs/plugin-vue";
import pathNode from "path";

const SOURCE = "../";

/** Create path*/
const createAliasPath = (path?: string) => {
  const correctPath = path ? `${SOURCE}/${path}` : SOURCE;
  return pathNode.resolve(__dirname, correctPath);
};

const config: StorybookConfig = {
  stories: ["../components/SharedLogo/SharedLogo.stories.@(ts|jsx|js|tsx)"],
  framework: "@storybook/vue3-vite",
  addons: [
    "storybook-addon-nuxt",
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/addon-interactions",
    "@chromatic-com/storybook"
  ],
  typescript: {
    check: true
  },
  async viteFinal(config) {
    const { mergeConfig } = await import("vite");

    const mergeConfigs = mergeConfig(config, {
      plugins: [vue()],
      resolve: {
        alias: {
          ...config.resolve?.alias,
          "~": createAliasPath()
        }
      }
    });

    return mergeConfigs;
  }
};

export default config;

My version nuxt: 3.11.2.
storybook-addon-nuxt 1.3.3(last) and storybook 8.11(last) have warn about their version

Screenshot storybook page
image

@tobiasdiez
Copy link
Collaborator

Probably this has the same underlying reason as #666.

@tobiasdiez tobiasdiez added type: bug Something isn't working status: help wanted Good idea, but the core developers will not work on it at the moment labels Jul 10, 2024
@TheDutchCoder
Copy link

Any timeline on this? Auto-imports is a fundamental feature of Nuxt 3, so without it, this module is virtually useless at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted Good idea, but the core developers will not work on it at the moment type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants