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

require problem while using with sveltekit. #127

Open
xeroticikot opened this issue Jun 6, 2022 · 1 comment
Open

require problem while using with sveltekit. #127

xeroticikot opened this issue Jun 6, 2022 · 1 comment
Labels
v1 Version 1.x.x

Comments

@xeroticikot
Copy link

How can npm installation can be used in sveltekit?
Tried different ways, but nothing's working for me.
Any reference would've been helpful & much appreciated.

@EPD24
Copy link

EPD24 commented Feb 11, 2023

Svelte doesn't support require so you have to use import instead, and since import creates a promise you need to use await on the import before initialising inside the DOM.

    import { onMount } from "svelte";
    import("halfmoon/css/halfmoon-variables.min.css");

    onMount(async () => {
    const halfmoon = await import("halfmoon");
    halfmoon.default.onDOMContentLoaded();
    });

@halfmoonui halfmoonui added the v1 Version 1.x.x label Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1 Version 1.x.x
Projects
None yet
Development

No branches or pull requests

3 participants