storybook icon indicating copy to clipboard operation
storybook copied to clipboard

"Failed to fetch dynamically imported module" when component emits an event with 2 or more arguments

Open andresilva-cc opened this issue 1 year ago • 5 comments

When accessing the story for a component, if the component emits a custom event with 2 or more arguments, it generates the following error:

Failed to fetch dynamically imported module: http://localhost:6006/stories/SecondExample.stories.ts

When trying to access other stories, it may occasionally generate the following error:

[plugin:vite:vue] Element is missing end tag.

PS: There isn't an end tag missing, and the error is caused by the other component (as mentioned in the Vite overlay).

By "2 or more arguments", I mean something like this:

this.$emit('example', 1, 2)

Some things to notice:

  • It generates the error when opening the story, even if the event was not emitted.
  • It does NOT happen with Composition API (with or without script setup)

Reproduction

Repository: https://github.com/andresilva-cc/nuxt3-storybook-emit-multiple-args-error

  1. Clone this repository: git clone https://github.com/andresilva-cc/nuxt3-storybook-emit-multiple-args-error
  2. Install the dependencies (I'm using yarn): yarn
  3. Run Storybook through Nuxt or independently: yarn dev or yarn storybook
  4. Access Storybook (probably http://localhost:6006)
  5. Try to open FirstExample, it may generate the error "Element is missing end tag", but the other component causes that. If you close Vite overlay, you'll see that the component is visible.
  6. Try to open SecondExample, it will generate the error "Failed to fetch dynamically imported module" and the component is not being rendered.

andresilva-cc avatar Apr 03 '24 17:04 andresilva-cc

I'm getting these same errors. Nuxt works, Storybook works. But this module fails to do anything at all, and only produces errors. 😢

matthew-dean avatar Apr 18 '24 23:04 matthew-dean

Also, adding this module completely trashes my Nuxt / Vite setup. Instead of serving up my Nuxt site in dev mode, it instead does a development build, which is not what I have configured at all. I don't see anything in the documentation that says that adding this module will force your Nuxt server to run differently and not support dev mode?

matthew-dean avatar Apr 18 '24 23:04 matthew-dean

Just tried upgrading to v8.0.0. Element is missing end tag. is still showing.

matthew-dean avatar Apr 22 '24 13:04 matthew-dean

any updates?

AdamovichArtur avatar Apr 22 '24 19:04 AdamovichArtur

Is this problem still present in the most recent version?

tobiasdiez avatar Jun 16 '24 11:06 tobiasdiez

Closing this issue due to inactivity :zzz: Please reopen the issue with additional information if the problem persists.

tobiasdiez avatar Aug 11 '24 20:08 tobiasdiez