Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find NPM package on Unpkg

I'm trying to include an unpkg link to a particular NPM package 'Angular Calendar' in my system.config.js file so I can run my site on a server without building every time.

I don't know how to find the link. The system.config.js file on the example site of the NPM package shows it referencing npm, which to me means locally. I've tried that and it didnt work.

 'angular-calendar': 'npm:[email protected]/dist/umd/angular-calendar.js',

I just get an error saying error loading ... as "angular-calendar"

Any ideas? Am I looking at the problem correctly? I'm trying to run my site on a server, without building. So I need to link to all the dependencies in system.config.js. I don't know how to link to third party packages. I understand that if it's an NPM package, there is an unpgk link. I just don't know how to find it.

Thanks

like image 971
fpolig01 Avatar asked Nov 21 '17 13:11

fpolig01


2 Answers

There is no official way to search for UNPKG packages but there is a third part website https://www.unpkgsearch.com/

You can search for packages and directly copy the unpkg link

like image 31
Amit Avatar answered Nov 01 '22 13:11

Amit


There are some more docs on their homepage at https://unpkg.com

To get a specific version:

If I enter the url: https://unpkg.com/[email protected]
It would serve: https://unpkg.com/[email protected]/dist/umd/angular-calendar.js

To get the latest version:

If I enter the url: https://unpkg.com/angular-calendar
It would serve: https://unpkg.com/[email protected]/bundles/angular-calendar.umd.js

To browse the files in a package:

If you append a / to the url, it will list all the files in the package, ie.

https://unpkg.com/[email protected]/ will list all the files in that particular package.

like image 95
Stephen Pham Avatar answered Nov 01 '22 13:11

Stephen Pham