storybook icon indicating copy to clipboard operation
storybook copied to clipboard

[Bug]: Vue. export props from vue component

Open Flashantik opened this issue 10 months ago • 2 comments

Describe the bug

if you export props from .vue component and try to use it in another component, you will get an error

[vite] Internal server error: Unexpected token, expected "," (1:8)
Plugin: storybook:vue-docgen-plugin

import { defineComponent as _defineComponent } from "vue";


To Reproduce

https://stackblitz.com/edit/github-egkjhp?file=src%2Fcomponents%2Fsubmit-button.stories.ts

System

The same result on [email protected]

Storybook Environment Info:

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm <----- active
    pnpm: 8.9.2 - /usr/local/bin/pnpm
  npmPackages:
    @storybook/addon-essentials: ^7.6.0-alpha.2 => 7.6.0-alpha.2 
    @storybook/addon-interactions: ^7.6.0-alpha.2 => 7.6.0-alpha.2 
    @storybook/addon-links: ^7.6.0-alpha.2 => 7.6.0-alpha.2 
    @storybook/blocks: ^7.6.0-alpha.2 => 7.6.0-alpha.2 
    @storybook/testing-library: ^0.2.2 => 0.2.2 
    @storybook/vue3: ^7.6.0-alpha.2 => 7.6.0-alpha.2 
    @storybook/vue3-vite: ^7.6.0-alpha.2 => 7.6.0-alpha.2 
    storybook: ^7.6.0-alpha.2 => 7.6.0-alpha.2

Additional context

No response

Flashantik avatar Oct 30 '23 15:10 Flashantik

In my project weirdly it works when I use an alias for the import:

This does not work:

import MyComponent, { type Props } from './MyComponent.vue'

This works:

import MyComponent, { type Props } from '@/components/MyComponent.vue'

thomasaull avatar Nov 20 '23 10:11 thomasaull

Hey, this will be fixed with #22285

larsrickert avatar Feb 17 '24 13:02 larsrickert

Fixed with #22285 in version 8

larsrickert avatar Mar 22 '24 08:03 larsrickert