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

SvelteKit issue #2

Open
gent-911 opened this issue Jun 6, 2021 · 5 comments
Open

SvelteKit issue #2

gent-911 opened this issue Jun 6, 2021 · 5 comments

Comments

@gent-911
Copy link

gent-911 commented Jun 6, 2021

svelte-lottie-player seems not to work with the latest sveltekit (SvelteKit v1.0.0-next.113).

Here is the error message:
SyntaxError: The requested module '/node_modules/lottie-web/build/player/lottie.js?v=8db5e539' does not provide an export named 'default'

@KrustyC
Copy link

KrustyC commented Jun 6, 2021

Same issue is happening here. I am using the same code from the README and getting this exact error

@rakanus
Copy link

rakanus commented Jun 21, 2021

me too same issue :
my try :
inside script tag :

let LottiePlayer; onMount(async () => { LottiePlayer = (await import('@lottiefiles/svelte-lottie-player')).default; });

inside HTML tag :

<svelte:component this={LottiePlayer} src="https://assets2.lottiefiles.com/packages/lf20_wxUJzo.json" autoplay={true} loop={true} controls={true} renderer="svg" background="transparent" height={600} width={600} />

Hope to be fixed soon ..

Any work around @Rich-Harris ?

@gent-911
Copy link
Author

@rakanus the solution does not work with the lattest svelte-kit. The package by itself works fine in the pure svelte env though, but with the svelte-kit it does not :(((

Any ideas from the author?

@TJennerjahn
Copy link

TJennerjahn commented Aug 24, 2021

This is an issue with vite and not svelte-kit.
This Packages depends on lottie-web, which currently does not export an esmodule. You can force vite to convert commonjs modules by adding

optimizeDeps: {
    include: ["lottie-web"],
},

to your vite.config.js file.

lottie-web needs to be in the package.json dependencies for this to work, not devDependencies or anything else.

@karamalie
Copy link
Contributor

Hi,

Do have a look at the working solution on #7 , built and ran yarn preview on a basic app and the player looks to render okay. Try it out and let me know if the same error still persists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants