{"id":281,"date":"2025-12-23T14:32:13","date_gmt":"2025-12-23T06:32:13","guid":{"rendered":"https:\/\/www.ddosgj.com\/?post_type=links&#038;p=281"},"modified":"2025-12-23T23:47:12","modified_gmt":"2025-12-23T15:47:12","slug":"unpkg","status":"publish","type":"links","link":"https:\/\/www.ddosgj.com\/fr\/liens\/281-html","title":{"rendered":"unpkg"},"content":{"rendered":"<p>unpkg est un r\u00e9seau mondial de diffusion de contenu rapide et gratuit pour l'\u00e9cosyst\u00e8me npm (gestionnaire de paquets Node.js). Il permet aux d\u00e9veloppeurs d'acc\u00e9der \u00e0 n'importe quel fichier contenu dans n'importe quel paquet publi\u00e9 sur npm directement via une URL, sans avoir besoin de t\u00e9l\u00e9charger ou de compiler quoi que ce soit.<\/p>\n<p>Son objectif est de fournir \u00e0 la communaut\u00e9 des d\u00e9veloppeurs front-end une m\u00e9thode extr\u00eamement simple pour acqu\u00e9rir et utiliser des ressources statiques (telles que JavaScript, CSS, polices, etc.) \u00e0 partir de paquets npm. Il sert de source de d\u00e9pendance populaire pour la cr\u00e9ation de prototypes, d'exemples et de sites web pr\u00eats \u00e0 \u00eatre mis en production.<\/p>\n<h3 style=\"color: #008000;\">1. Informations de base sur unpkg<\/h3>\n<ul>\n<li>Nom du fournisseur de services : unpkg<\/li>\n<li>Nom anglais : unpkg<\/li>\n<li>Date de cr\u00e9ation : Sans objet (projet open source)<\/li>\n<li>Adresse du si\u00e8ge social : sans objet (pris en charge par le r\u00e9seau Cloudflare)<\/li>\n<li>Adresse du site officiel :<a href=\"https:\/\/unpkg.com\/\">https:\/\/unpkg.com\/<\/a><\/li>\n<li>Type de service : H\u00e9bergement CDN public pour les paquets npm<\/li>\n<li>Prix de r\u00e9f\u00e9rence : Gratuit<\/li>\n<li>Existe-t-il une version d'essai ? Enti\u00e8rement gratuit.<\/li>\n<\/ul>\n<h3 style=\"color: #008000;\">2. Principaux avantages et caract\u00e9ristiques techniques d'unpkg<\/h3>\n<p><strong>Synchronisation approfondie avec le r\u00e9f\u00e9rentiel npm<\/strong><br \/>\nProxy direct de l'ensemble du r\u00e9f\u00e9rentiel npm, permettant un acc\u00e8s direct via URL \u00e0 tout paquet publi\u00e9 sur npm et \u00e0 tous les fichiers de ses versions, pour une synchronisation en temps r\u00e9el.<\/p>\n<p><strong>Mod\u00e8le de conception d'URL minimaliste<\/strong><br \/>\nEn adoptant un sch\u00e9ma d'URL clair et pr\u00e9visible (tel que `unpkg.com\/:package@:version\/:file`), les d\u00e9veloppeurs peuvent rapidement cr\u00e9er des liens vers des fichiers sans avoir \u00e0 consulter la documentation.<\/p>\n<p><strong>Service intelligent de fichiers par d\u00e9faut<\/strong><br \/>\nLorsqu'une URL pointe vers un r\u00e9pertoire de paquet plut\u00f4t que vers un fichier sp\u00e9cifique, elle localise et renvoie automatiquement le fichier sp\u00e9cifi\u00e9 par le champ \u00ab main \u00bb du paquet ou un fichier au format \u00ab umd \u00bb, ce qui simplifie consid\u00e9rablement l'utilisation.<\/p>\n<p><strong>Propuls\u00e9 par le r\u00e9seau mondial Cloudflare<\/strong><br \/>\nTout le trafic est distribu\u00e9 et mis en cache via le r\u00e9seau mondial Cloudflare, offrant ainsi un acc\u00e8s mondial haut d\u00e9bit et \u00e0 faible latence.<\/p>\n<h3 style=\"color: #008000;\">3. Principaux produits et services d'unpkg<\/h3>\n<ul>\n<li>H\u00e9bergement CDN public et services de fichiers pour les paquets npm.<\/li>\n<li>Prend en charge les demandes de versions sp\u00e9cifiques de fichiers par num\u00e9ro de version, balise ou plage de versions s\u00e9mantiques.<\/li>\n<li>G\u00e9n\u00e9rer et renvoyer automatiquement des fichiers de script ex\u00e9cutables par le navigateur au format UMD dans le package.<\/li>\n<\/ul>\n<h3 style=\"color: #008000;\">4. unpkg prend en charge les r\u00e9gions \/ devises de facturation<\/h3>\n<p>Zone de couverture : distribu\u00e9 via le r\u00e9seau mondial Cloudflare, qui couvre des centaines de centres de donn\u00e9es \u00e0 travers le monde.<\/p>\n<p>Caract\u00e9ristiques de la couverture : en tant que service public, il b\u00e9n\u00e9ficie d'une couverture r\u00e9seau \u00e9tendue et de performances \u00e9lev\u00e9es, con\u00e7ues pour offrir aux d\u00e9veloppeurs du monde entier une exp\u00e9rience d'acc\u00e8s rapide et coh\u00e9rente.<\/p>\n<p>Devises de facturation prises en charge : service gratuit, aucun r\u00e8glement en devises.<\/p>\n<h3 style=\"color: #008000;\">5. Comment int\u00e9grer avec unpkg<\/h3>\n<ol>\n<li>D\u00e9terminez le nom et la version du paquet npm dont vous avez besoin (par exemple, \u00ab vue@3.4.0 \u00bb).<\/li>\n<li>Dans les balises `` du fichier HTML, ajoutez un `<script>` \u6807\u7b7e\u3002<\/li>\n<li>\u5728 `src` \u5c5e\u6027\u4e2d\uff0c\u6309\u7167 `https:\/\/unpkg.com\/\u5305\u540d@\u7248\u672c\/\u6587\u4ef6\u8def\u5f84` \u7684\u683c\u5f0f\u586b\u5199 URL\u3002\u4f8b\u5982\uff1a`https:\/\/unpkg.com\/vue@3.4.0\/dist\/vue.global.js`\u3002<\/li>\n<li>\u5982\u679c\u53ea\u5199\u5305\u540d\u548c\u7248\u672c\uff0c\u4e0d\u6307\u5b9a\u5177\u4f53\u6587\u4ef6\u8def\u5f84\uff0cunpkg \u4f1a\u8fd4\u56de\u8be5\u5305\u7684\u4e3b\u5165\u53e3\u6587\u4ef6\uff08\u901a\u5e38\u662f\u6d4f\u89c8\u5668\u53ef\u7528\u7684 UMD \u5305\uff09\u3002\u4f8b\u5982\uff1a`https:\/\/unpkg.com\/vue@3.4.0`\u3002<\/li>\n<li>\u4fdd\u5b58 HTML \u6587\u4ef6\uff0c\u5e76\u5728\u6d4f\u89c8\u5668\u4e2d\u6253\u5f00\uff0c\u811a\u672c\u5c06\u81ea\u52a8\u4ece unpkg \u52a0\u8f7d\u5e76\u6267\u884c\u3002<\/li>\n<\/ol>\n<h3 style=\"color:#008000\">6. unpkg \u5e94\u7528\u573a\u666f<\/h3>\n<\/p>\n<ul>\n<li>\u5feb\u901f\u521b\u5efa\u5728\u7ebf\u4ee3\u7801\u6f14\u793a\u3001\u4ea4\u4e92\u5f0f\u6559\u7a0b\u6216\u6280\u672f\u6982\u5ff5\u9a8c\u8bc1\uff0c\u65e0\u9700\u642d\u5efa\u672c\u5730\u6784\u5efa\u73af\u5883\u3002<\/li>\n<li>\u5728\u5c0f\u578b\u9879\u76ee\u3001\u4e2a\u4eba\u535a\u5ba2\u6216\u7ba1\u7406\u540e\u53f0\u4e2d\uff0c\u76f4\u63a5\u5f15\u5165 React\u3001Vue\u3001Lodash \u7b49\u5e38\u7528\u5e93\u7684\u7279\u5b9a\u7248\u672c\u3002<\/li>\n<li>\u524d\u7aef\u5f00\u53d1\u8005\u63a2\u7d22\u548c\u6d4b\u8bd5 npm \u4e0a\u65b0\u53d1\u5e03\u7684\u5e93\u6216\u4e0d\u540c\u7248\u672c\uff0c\u65e0\u9700\u8fdb\u884c `npm install`\u3002<\/li>\n<li>\u5728 StackOverflow \u7b49\u793e\u533a\u56de\u7b54\u95ee\u9898\u65f6\uff0c\u63d0\u4f9b\u53ef\u76f4\u63a5\u5728\u6d4f\u89c8\u5668\u4e2d\u8fd0\u884c\u7684\u4ee3\u7801\u7247\u6bb5\u94fe\u63a5\u3002<\/li>\n<\/ul>\n<h3 style=\"color:#008000\">7. unpkg \u5e38\u89c1\u95ee\u7b54<\/h3>\n<\/p>\n<p><strong>\u4f7f\u7528 unpkg \u662f\u5426\u6536\u8d39\uff1f<\/strong><br \/>\u5b8c\u5168\u514d\u8d39\u3002\u5b83\u662f\u4e00\u4e2a\u7531\u793e\u533a\u7ef4\u62a4\u3001Cloudflare \u63d0\u4f9b\u57fa\u7840\u8bbe\u65bd\u652f\u6301\u7684\u516c\u5171\u798f\u5229\u9879\u76ee\u3002<\/p>\n<\/p>\n<p><strong>\u5982\u4f55\u5f15\u7528\u4e00\u4e2a\u5305\u7684\u6700\u65b0\u7248\u672c\uff1f<\/strong><br \/>\u53ef\u4ee5\u5728 URL \u4e2d\u7701\u7565\u7248\u672c\u53f7\uff08\u5982 `unpkg.com\/vue`\uff09\uff0c\u4f46\u8fd9\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u4e0d\u63a8\u8350\uff0c\u56e0\u4e3a\u7248\u672c\u66f4\u65b0\u53ef\u80fd\u5bfc\u81f4\u4ee3\u7801\u4e0d\u517c\u5bb9\u3002<\/p>\n<\/p>\n<p><strong>\u5728\u751f\u4ea7\u73af\u5883\u4f7f\u7528\u662f\u5426\u5b89\u5168\uff1f<\/strong><br \/>\u6280\u672f\u4e0a\u53ef\u9760\uff0c\u4f46\u5b58\u5728\u6f5c\u5728\u98ce\u9669\u3002\u4e00\u65e6\u5305\u4f5c\u8005\u53d1\u5e03\u5305\u542b\u6076\u610f\u4ee3\u7801\u7684\u65b0\u7248\u672c\uff0c\u82e5\u4f7f\u7528\u201c\u6700\u65b0\u7248\u672c\u201d\u7684\u5f15\u7528\u65b9\u5f0f\uff0c\u7f51\u7ad9\u4f1a\u7acb\u5373\u53d7\u5230\u5f71\u54cd\u3002\u56e0\u6b64\u5f3a\u70c8\u5efa\u8bae\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u9501\u5b9a\u5177\u4f53\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<p><strong>\u5b83\u80fd\u52a0\u901f\u6240\u6709\u7c7b\u578b\u7684 npm \u5305\u5417\uff1f<\/strong><br \/>\u5b83\u4e3b\u8981\u9488\u5bf9\u5305\u5185\u7684\u9759\u6001\u8d44\u6e90\u6587\u4ef6\uff08`.js`\uff0c `.css`\uff0c `.json` \u7b49\uff09\u8fdb\u884c\u4f18\u5316\u548c\u52a0\u901f\u3002\u5bf9\u4e8e\u9700\u8981\u5728 Node.js \u73af\u5883\u4e2d\u6267\u884c\u7684\u6a21\u5757\uff0c\u867d\u7136\u53ef\u4ee5\u83b7\u53d6\u6587\u4ef6\uff0c\u4f46\u65e0\u6cd5\u5728\u6d4f\u89c8\u5668\u4e2d\u76f4\u63a5\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><strong>unpkg \u548c cdnjs \u6709\u4ec0\u4e48\u533a\u522b\uff1f<\/strong><br \/>cdnjs \u6258\u7ba1\u4e00\u4e2a\u7cbe\u5fc3\u6311\u9009\u7684\u524d\u7aef\u5e93\u5217\u8868\uff1b\u800c unpkg \u81ea\u52a8\u4ee3\u7406\u4e86\u6574\u4e2a npm \u4ed3\u5e93\uff0c\u8303\u56f4\u66f4\u5e7f\uff0c\u4f46\u6587\u4ef6\u662f\u5426\u517c\u5bb9\u6d4f\u89c8\u5668\u9700\u8981\u7528\u6237\u81ea\u884c\u5224\u65ad\u3002unpkg \u7684 URL \u6a21\u5f0f\u4e5f\u66f4\u7b80\u5355\u76f4\u63a5\u3002<\/p>\n<\/p>\n<p><strong>\u5982\u679c unpkg \u670d\u52a1\u5b95\u673a\u4e86\u600e\u4e48\u529e\uff1f<\/strong><br \/>\u867d\u7136\u5176\u57fa\u7840\u8bbe\u65bd\u975e\u5e38\u53ef\u9760\uff0c\u4f46\u4efb\u4f55\u5355\u4e00\u670d\u52a1\u70b9\u90fd\u5b58\u5728\u98ce\u9669\u3002\u5bf9\u4e8e\u6838\u5fc3\u751f\u4ea7\u4f9d\u8d56\uff0c\u5efa\u8bae\u91c7\u53d6\u5907\u4efd\u65b9\u6848\uff0c\u5982\u81ea\u884c\u6258\u7ba1\u6216\u4f7f\u7528\u5176\u4ed6\u516c\u5171 CDN \u4f5c\u4e3a\u5907\u6e90\u3002<\/p>\n<\/p>\n<h3 style=\"color:#008000\">\u7f16\u8f91\u8865\u5145\u8bf4\u660e<\/h3>\n<\/p>\n<p>unpkg \u662f npm \u751f\u6001\u4e2d\u4e00\u9879\u91cd\u8981\u7684\u516c\u5171\u57fa\u7840\u8bbe\u65bd\uff0c\u6781\u5927\u5730\u7b80\u5316\u4e86\u524d\u7aef\u5f00\u53d1\u4e2d\u5e93\u7684\u83b7\u53d6\u548c\u4f7f\u7528\u3002\u7136\u800c\uff0c\u5f00\u53d1\u8005\u9700\u8c28\u614e\u5bf9\u5f85\u7248\u672c\u7ba1\u7406\uff0c\u907f\u514d\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u4f7f\u7528\u6307\u5411\u201c\u6700\u65b0\u7248\u672c\u201d\u7684\u6d6e\u52a8\u94fe\u63a5\uff0c\u4ee5\u9632\u56e0\u4e0a\u6e38\u5305\u7684\u7834\u574f\u6027\u66f4\u65b0\u5bfc\u81f4\u7ebf\u4e0a\u6545\u969c\u3002\u5bf9\u4e8e\u5173\u952e\u4e1a\u52a1\uff0c\u5efa\u8bae\u5c06\u4f9d\u8d56\u6587\u4ef6\u4e0b\u8f7d\u5e76\u6258\u7ba1\u5728\u81ea\u5df1\u7684CDN\u4e0a\u3002<\/p>\n<\/p>\n<p><span data-mce-type=\"bookmark\" style=\"display: inline-block; width: 0px; overflow: hidden; line-height: 0;\" class=\"mce_SELRES_start\"><\/span><\/p>\n<p>\n<\/script><\/li>\n<\/ol>","protected":false},"excerpt":{"rendered":"<p>Un CDN mondial pour les paquets npm, permettant le chargement direct de fichiers dans les paquets npm via une URL.<\/p>","protected":false},"featured_media":282,"comment_status":"open","ping_status":"closed","template":"","link_cat":[110],"class_list":["post-281","links","type-links","status-publish","has-post-thumbnail","hentry","link_cat-cdn-tools"],"_links":{"self":[{"href":"https:\/\/www.ddosgj.com\/fr\/wp-json\/wp\/v2\/links\/281","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ddosgj.com\/fr\/wp-json\/wp\/v2\/links"}],"about":[{"href":"https:\/\/www.ddosgj.com\/fr\/wp-json\/wp\/v2\/types\/links"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ddosgj.com\/fr\/wp-json\/wp\/v2\/comments?post=281"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ddosgj.com\/fr\/wp-json\/wp\/v2\/media\/282"}],"wp:attachment":[{"href":"https:\/\/www.ddosgj.com\/fr\/wp-json\/wp\/v2\/media?parent=281"}],"wp:term":[{"taxonomy":"link_cat","embeddable":true,"href":"https:\/\/www.ddosgj.com\/fr\/wp-json\/wp\/v2\/link_cat?post=281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}