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

Error when importing lottie #14

Open
michielsarne opened this issue Dec 31, 2022 · 1 comment
Open

Error when importing lottie #14

michielsarne opened this issue Dec 31, 2022 · 1 comment

Comments

@michielsarne
Copy link

Hello,

I get this error when I try to import lottie, anyone who knows how to fix this?

error message:

'LottiePlayer' is declared but its value is never read.js(6133)
Could not find a declaration file for module '@lottiefiles/svelte-lottie-player'. 'c:/sites/components/components-app/node_modules/@lottiefiles/svelte-lottie-player/dist/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/lottiefiles__svelte-lottie-player if it exists or add a new declaration (.d.ts) file containing declare module '@lottiefiles/svelte-lottie-player';js(7016)

Thanks in advance !

@asifqatar
Copy link

asifqatar commented Jan 31, 2023

@michielsarne you can import module dynamically i.e

  let LottiePlayer;

  onMount(async () => {
    const module = await import("@lottiefiles/svelte-lottie-player");
    LottiePlayer = module.LottiePlayer;
  });```

and also used it like

{#if LottiePlayer}
    <LottiePlayer
	src="background-fullscreen.json"
	autoplay={true}
	loop={true}
	controls={true}
	renderer="svg"
	background="transparent"
	height={600}
	width={600} />
{/if}

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

2 participants