It took us quite some time, and you started unpkg a year sooner than we had our new /npm endpoint, but jsDelivr is far from a copy of unpkg. I can't remember off hand if there's any other specific setup you'll jsDelivr has been around since 2012, and we've been discussing alternatives to manually uploading files to the CDN since 2014. You'll probably need to run a Redis server and set the $REDIS_URL environment variable to boot everything. And please let me know if you have trouble running it locally. Hopefully that will let you reproduce the error. But who knows if this is actually the problem or not.īut ya, you should be able to just download and run everything locally. In this case, ideally only the first request should trigger the fetch and every subsequent request should be able to just wait until that work is done. I wonder if the problem could be that many requests for the same package trigger multiple fetches and the files are being overwritten on disk, causing a race condition. When a lot of requests come in for the same package we have to do a bunch of work to download it, decompress it, save it to disk, and then serve the file. I'm thinking it could be a race condition somewhere. I haven't set up rate limiting on the CDN, but maybe Cloudflare does some rate limiting by default. I don't believe that rate limiting should ever be a problem on. I'm planning on running unpkg locally and seeing if I can replicate the errors there w/ logging, but any info you can provide would be much appreciated. Other times, instead of a 503, I'll get back a 404 with the Not found: file "/folder/file.ext" in package (with actual file path & package name in error) - but upon refreshing the URL, the file contents come back totally are you aware of any issues that might be causing this? (i.e. ![]() For example, about an hour ago I performed an install of and got back a 503 for this file - but after refreshing that file's URL, the file contents were successfully sent back. However, I've noticed that Unpkg will send back 503's and incorrect 404's from time to time, and I'm thinking that it might be due to a race condition that happens when Unpkg encounters a package it's seen for the first time. ![]() For a large package like Angular it will typically make ~100-200 requests within a 5s period, and performance/reliability typically isn't a problem. An important note is that we are not downloading UMD/dist builds, but instead downloading all files required from the main/module/typings field in the package JSON. If you skipped the Introduction, we strongly recommend reading it before moving on to the rest of the documentation.I'm working on an in-browser NPM client for System that intelligently downloads all of the files the app needs from Unpkg (instead of downloading everything w/ the actual tarball). If you intend to use Composition API without a build step, consult the usage of the setup() option. Many of the examples for Composition API will be using the syntax. Using Composition API without a Build Step If you are using VSCode, you can install the es6-string-html extension and prefix the strings with a /*html*/ comment to get syntax highlighting for them. You may have noticed that the imported component's template is inlined as a JavaScript string. You can also use any other HTTP server that can serve static files with the correct MIME types. To start a local HTTP server, first install Node.js and then run npx serve from the command line in the same directory where your HTML file is. In order for this to work, you need to serve your index.html over the protocol, with a local HTTP server. ![]() If you directly open the above index.html in your browser, you will find that it throws an error because ES modules cannot work over the file:// protocol.
0 Comments
Leave a Reply. |