justinribeiro / lite-youtube

The fastest little YouTube web component on this side of the internet. The shadow dom web component version of Paul's lite-youtube-embed.

Home Page:https://www.npmjs.com/package/@justinribeiro/lite-youtube

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CDN: Uncaught SyntaxError: Unexpected token 'export' (at lite-youtube.js:1:1)

Juc1 opened this issue · comments

commented

I am using the CDN - my HTML page source has

<lite-youtube videoid="guJLfqTFfIw"></lite-youtube>
<script src="https://cdn.jsdelivr.net/npm/@justinribeiro/lite-youtube@1.5.0/lite-youtube.js"></script>

but no video is rendered and console has error
Uncaught SyntaxError: Unexpected token 'export' (at lite-youtube.js:1:1)

Any ideas please?

You're missing the the type=module on the script tag:

<script type="module" src="https://cdn.jsdelivr.net/npm/@justinribeiro/lite-youtube@1.5.0/lite-youtube.js"></script>
commented

Ok fixed, thank you :)

commented

@justinribeiro my SEO audit tool semrush is complaining that the CDN link is not minified - would it be possible for you to add a minified version to the CDN?

Just add .min and it'll minimize.

<script type="module" src="https://cdn.jsdelivr.net/npm/@justinribeiro/lite-youtube@1.5.0/lite-youtube.min.js"></script>

image

commented

@justin yes that works thank you