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

svelte / sveltekit usage #2

Open
cbergen opened this issue Jun 1, 2021 · 4 comments
Open

svelte / sveltekit usage #2

cbergen opened this issue Jun 1, 2021 · 4 comments

Comments

@cbergen
Copy link

cbergen commented Jun 1, 2021

The only way I could successfully import cqfill into a ".svelte" file was like this:

<script>
    // Error: "Uncaught (in promise) TypeError: cqfill is not a function"    
    // import { cqfill } from "cqfill";

    import { cqfill } from '../../node_modules/cqfill/export/cqfill';

    cqfill();
</script>

Not sure if this is a problem with the module or something I'm doing.

@bluwy
Copy link

bluwy commented Jun 15, 2021

This isn't svelte / sveltekit specific, but more Vite related. The output ESM file seems to not be ESM.

@jasikpark
Copy link
Contributor

in theory, it should be esm, no?

// Minify ESM version

@jasikpark
Copy link
Contributor

I believe you need to specify cqfill.mjs rather than just cqfill.js? Maybe there's a package.json config that's incorrect somehow?

@bluwy
Copy link

bluwy commented Nov 3, 2021

Just got notification on this. Taking another look again, the output is indeed already in ESM, but I have mistaken how the exports work. @cbergen If you want to manually call cqfill(), you should import from cqfill/export instead. Importing from cqfill would run the polyfill automatically, if that's desired.

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

No branches or pull requests

3 participants