pqina / svelte-filepond

🔌 A handy FilePond adapter component for Svelte
MIT License
247 stars 10 forks source link

Not compatible with rollup-plugin-svelte version 7 #11

Closed ile closed 2 years ago

ile commented 2 years ago

Describe the bug

When using rollup-plugin-svelte version 7, the FilePond element isn't instantiated correctly. I get this when loading the app in a browser:

index.mjs:1849 Uncaught TypeError: Illegal constructor
    at new SvelteElement (index.mjs:1849)
    at new App (App.svelte:33)
    at main.js:3
    at main.js:5

To Reproduce

The only changes:

svelte({
    // enable run-time checks when not in production
    // we'll extract any component CSS out into
    // a separate file - better for performance
    compilerOptions: {
        // enable run-time checks when not in production
        dev: !production,
        css: true,
        customElement: true
    },
    // for importing filepond css from nodemodules
    preprocess: sveltePreprocess({ postcss: true }),
}),

It seems to me that Component.svelte isn't even loaded (in filepond-svelte).

Repository: https://github.com/ilkkah/filepond-example

rikschennink commented 2 years ago

Just tested with v7 and works correctly.

It might have to do with setting customElement to true

Will close because can't reproduce.

ile commented 2 years ago

True, the customElement breaks it.

Could something be done to that? I still need the customElement, it's useful (will contain only its own CSS for example). If svelte-filepond would work with customElement, that would be good too.

rikschennink commented 2 years ago

That won't work, the FilePond core is not written as a custom element. So CSS selectors will probably not find the right elements. There's also challenges with shadow DOM and event handling that is currently not compatible.