[Vuejs]-Storybook file does not import corresponding .vue

0👍

After creating index.d.ts, I can import .vue file and success to dispay on Storybook.

index.d.ts

declare module '*.vue' {
  import Vue from 'vue'
  const _default: Vue
  export default _default
}

index.stories.ts

import Test from './index.vue'

export default {
  component: Test,
  title: 'Components/Test'
}

export const Primary = () => ({
  components: { Test },
  template: '<Test />'
})

Leave a comment