luminous icon indicating copy to clipboard operation
luminous copied to clipboard

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

Open aiboost opened this issue 1 year ago • 0 comments

Before you submit:

  • [ x ] Please read the contributing guidelines
  • [ x ] Please search through the existing issues (both open AND closed) to see if your feature has already been discussed. Github issue search can be used for this: https://github.com/imgix/vue/issues?utf8=%E2%9C%93&q=is%3Aissue
  • [ x ] Please take a moment to find out whether your idea fits with the scope and aims of the project

The problem

I wish to include Luminous onto my page my just embedding a

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.

aiboost avatar Jul 09 '23 10:07 aiboost