how to get the url for a package in npmjs.com instead of installing with npm
Asked Answered
G

2

6

I am creating a reactjs based html page.

I want to use normalizr for my data.

I can get the reactjs directly in the html by the following:

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react.js"></script>

But how to get normalizr. I didnt find any such link. Because it says to install using npm.

I want to directly use in the html like reactjs as above so is it possible

Grubstake answered 24/11, 2018 at 5:12 Comment(2)
What you want is a CDN, basically a URL from which the module is hosted. You can try this one: cdn.jsdelivr.net/npm/[email protected]/dist/normalizr.min.jsAquatint
is this link mentioned somewhere in npmjs.com/package/normalizr/v/3.3.0Grubstake
T
8

You can use unpkg to any file from any npm library as a link.

For normalizr, the URL would be

https://unpkg.com/[email protected]/dist/normalizr.min.js

If you need any other file from normalizer repo, you can file the link for the file here

https://unpkg.com/[email protected]/dist/

unpkg is super-fast and better than most cdns out there.

Taddeo answered 24/11, 2018 at 5:24 Comment(2)
is this link mentioned somewhere in npmjs.com/package/normalizr/v/3.3.0Grubstake
No, unpkg is not part of npm but rather uses npm's registry along with Cloudflare and Heroku to provide a super-fast CDN. The file you get is directly what's found in the npm registry.Taddeo
V
0

Apart from normalizer, you can also use:

npm-cdn

https://npm-cdn.herokuapp.com/[email protected]/dist/normalizr.min.js

Valdis answered 24/11, 2018 at 5:29 Comment(2)
is this link mentioned somewhere in npmjs.com/package/normalizr/v/3.3.0Grubstake
If you check out the npm-cdn package on npmjs.com, you will find the documentation on how to form an urlValdis

© 2022 - 2024 — McMap. All rights reserved.