Skip to content

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

@aiboost

Description

@aiboost

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions