Skip to content

Cryptic message when using svelte-file-dropzone with storybook #45

Closed
@Volubyl

Description

@Volubyl

Hello, first of all thank you for creating this lib.

Coming from React it's a pleasure to find something similar to react-dropzone.

While trying to use the lib with storybook I have this message that appears instead of the story

import DropZone from "./components/Dropzone.svelte"; export default DropZone;

Do you have an idea where this can come from?

The strange thing is that the lib works fine in svelte/sapper but not in storybook.

Versions used :

"sapper": "^0.28.0",
"svelte": "^3.32.1",
"@storybook/svelte": "^6.1.17"

The component code :


// DragAndDrop.svelte

<script>
    import Dropzone from "svelte-file-dropzone";
  let files = {
    accepted: [],
    rejected: []
  };
  function handleFilesSelect(e) {
    const { acceptedFiles, fileRejections } = e.detail;
    files.accepted = [...files.accepted, ...acceptedFiles];
    files.rejected = [...files.rejected, ...fileRejections];
  }
</script>

<Dropzone on:drop={handleFilesSelect} />
<ol>
  {#each files.accepted as item}
    <li>{item.name}</li>
  {/each}
</ol>

And the story code

import DragAndDrop from './DragAndDrop.svelte';
export default {
  title: 'UI/DragAndDrop',
  component: DragAndDrop,
  args: {},
};
export const Primary = () => ({
  Component: DragAndDrop,
  props: {},
});

I looked at your source code and I found this

https://github.com/thecodejack/svelte-file-dropzone/blob/master/src/index.js

Maybe it's related ?

Don't hesitate if I can help with something.

Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions