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

ES Module #134

Closed
MCMattia opened this issue Nov 14, 2022 · 3 comments
Closed

ES Module #134

MCMattia opened this issue Nov 14, 2022 · 3 comments

Comments

@MCMattia
Copy link

Hi guys I am using sveltekit and lite-youtube-embed but I am getting the following error when I launch pnpm run dev. I don't know much of cjs and ES module. I am opening this issue to report the problem and hopefully somebody competent can handle it.

lite-youtube-embed doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.

lite-youtube-embed works more or less in dev mode but not in production.

@Garbee
Copy link
Contributor

Garbee commented Nov 14, 2022

The built file is not a module at all. There are no exports of any kind. It is a standalone script that needs to get dropped into the page and then used.

I'm sure on the specifics of what Sveltkit is doing and how you're trying to use it. Seems like a problem with the way you're trying to import the script into something else when it isn't feasible. Maybe a bare import would work, but that would still confuse a compiler most likely.

@mateomorris
Copy link

Used this successfully with Svelte: https://github.com/zamanruhy/svelte-lite-youtube-embed

@paulirish
Copy link
Owner

paulirish commented Mar 3, 2024

Duping this into #1

The most obvious ways to publish this on NPM in a way that's bundler friendly result in sacrificing the web performance details. The most obvious part: The CSS should be bundled into your CSS.. it should not be added via clientside javascript.

The svelte port (and other frameworky ports) generally publish this is a more friendly way (that probably is slightly worse for performance.) Using them seems alright. :)

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

4 participants