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

Not compatible with storybook 6 #26

Open
adambullmer opened this issue Oct 6, 2020 · 1 comment
Open

Not compatible with storybook 6 #26

adambullmer opened this issue Oct 6, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@adambullmer
Copy link

adambullmer commented Oct 6, 2020

When upgrading an existing vue storybook project to storybook >=6.0.0, the following error is returned in the UI:

Unexpected default export without title: undefined
Error: Unexpected default export without title: undefined
    at http://localhost:8080/vendors~main.d193a683a2dcb6796807.bundle.js:10575:15
    at Array.forEach (<anonymous>)
    at http://localhost:8080/vendors~main.d193a683a2dcb6796807.bundle.js:10568:11
    at ConfigApi.configure (http://localhost:8080/vendors~main.d193a683a2dcb6796807.bundle.js:7619:7)
    at Object.configure (http://localhost:8080/vendors~main.d193a683a2dcb6796807.bundle.js:10716:17)
    at configure (http://localhost:8080/vendors~main.d193a683a2dcb6796807.bundle.js:12296:24)
    at Object.<anonymous> (http://localhost:8080/main.d193a683a2dcb6796807.bundle.js:15102:36)
    at Object../.storybook/generated-stories-entry.js (http://localhost:8080/main.d193a683a2dcb6796807.bundle.js:15103:30)
    at __webpack_require__ (http://localhost:8080/runtime~main.d193a683a2dcb6796807.bundle.js:849:30)
    at fn (http://localhost:8080/runtime~main.d193a683a2dcb6796807.bundle.js:151:20)

I believe storybook 6 requires that story files follow the SFC spec:

import { action } from "@storybook/addon-actions";
import { linkTo } from "@storybook/addon-links";

import MyButton from "../components/MyButton.vue";

export default {
  component: MyButton,
  title: "Button"
};

export const withText = () => ({
  components: { MyButton },
  template: '<my-button @click="action">Hello Button</my-button>',
  methods: { action: action("clicked") }
});

Also, with the deprecation of config.js, I believe the configure and loadStories hooks have been lost, which may be necessary for this package to work properly.

EDIT
Errors will go away be defining a title attribute on the exported Vue component. In my case I am using the Class syntax from typescript so I had to do:

<script lang="ts">
import { Vue, Component } from "vue-property-decorator";

@Component
export default class ComponentStory extends Vue {
  public static title = "My Component";
}

While this does suppress the errors, these stories do not get loaded into the manager, which I think is related to the config.js storyloader from before.

@mattrothenberg
Copy link
Owner

Hi @adambullmer, this project hasn't been updated in nearly a year, so this error stands to reason.

PRs are totally welcome to make the project compatible with Storybook 6!

@mattrothenberg mattrothenberg added the enhancement New feature or request label Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants