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

Direct including a script from CDN (Unpkg, jsDelivr, ...) #625

Open
aiboost opened this issue Jul 9, 2023 · 0 comments
Open

Direct including a script from CDN (Unpkg, jsDelivr, ...) #625

aiboost opened this issue Jul 9, 2023 · 0 comments

Comments

@aiboost
Copy link

aiboost commented Jul 9, 2023

Before you submit:

The problem

I wish to include Luminous onto my page my just embedding a <script> tag linking to UnPkg or jsDelivr CDN.
But getting this error:

Uncaught ReferenceError: exports is not defined
    at lum.js:3:23

This can be bypassed by:

  1. Compiling the module into another JS file, hosting it somewhere and linking on it. You use this way on your CodePen demo. But I can not be sure how long will be alive the compiled file you hosted: https://s3-us-west-2.amazonaws.com/s.cdpn.io/164071/Luminous.min.js
  2. or a developer can create some external script and import there Luminous like in module:

import {LuminousGallery} from "https://unpkg.com/luminous-lightbox";

but this requires this new script to be included into HTML with type="module" attribute.

All these two ways are significantly more complicated than just including a snippet.

Suggested solution

Please consider adopting the package on NPM to be compliant with including as a snippet.
All JS libraries nowadays offer such an opportunity, I wish Luminous could also do.

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

1 participant