The need of umd global variable name

Hi everyone !

I am working on code splitting and import() function to be transpilled to use CDN.

So my goal is the user write sth like

import(‘lodash’).then(lodashDefault => mod.get(…))

and under the hood it is transpile with a module in sth like

cdnjs.import(‘lodash’).then(lodashDefault => …)

I have already something that is working based on unpkg but the pain point is asking the dev to provide the mapping between the package name and the path and the global variable.

Then I have discovered cdnjs … while using codepen.

By the way even in codepen when you have added let react you have to know the global var is React.

Devs don t want to search for that.

lodash global is _
react global is React
etc …

So I would like to leverage the work you guys did on the packages repository and start adding this global metadata.

I know this one can not be applied to every package (like jquery plugins which are attached to global jquery) but we could propose a jsonpath.

So first thing what do you think about it ?

I am not a JS expert but why would you want to do this with a cdn?
Because it is local development (code splitting and import) so you should use a package manager like npm or yarn and then use something like webpack to build your JS modules and do code splitting, minification , …
I don’t understand why would use a cdn anywhere in this process.