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.
https://www.npmjs.com/package/@justinribeiro/lite-youtube
MIT License
836 stars 63 forks source link

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

Closed Juc1 closed 1 year ago

Juc1 commented 1 year ago

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?

justinribeiro commented 1 year ago

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>
Juc1 commented 1 year ago

Ok fixed, thank you :)

Juc1 commented 1 year ago

@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?

justinribeiro commented 1 year ago

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

Juc1 commented 1 year ago

@justin yes that works thank you