You don't need a CDN
Many articles about building SharePoint Framework solutions mention uploading your files to a CDN. But are you sure you actually need one?
What is a CDN
Content Delivery Network (CDN) is a system, that uses servers distributed around the globe to deliver files to users. By automatically choosing the server located the closest to the user, a CDN can significantly decrease the time needed to load files. When using a CDN, you upload your files once, and the system automatically distributes them to servers across the globe that are a part of the CDN.
Does SharePoint Framework require a CDN
When building SharePoint Framework solutions, you have a solution package - the .sppkg file, and a number of scripts and other assets. The .sppkg file is deployed to SharePoint and contains a manifest with the URL pointing to where the script files are located. The script files have to be uploaded to the location specified in the manifest or the web part won’t load when added to the page in SharePoint.
Many articles describing the deployment process of SharePoint Framework solutions, refer to uploading script files to CDN. While you can indeed use a CDN, you don’t have to. Using a CDN is not a must. In fact, SharePoint Framework doesn’t impose any restrictions with regards to where you deploy your scripts to. Sure, you can deploy them to a CDN, but you could as well use a regular Document Library in SharePoint or upload your files to Azure Blob Storage or a webserver under your desk. As long as the files are accessible through a URL, your solution will work. Of course, each of these options have their pro’s and cons with regards to scalability, costs, performance and operational effort, but you can use any of them.
When using a CDN makes sense
If your organization has employees in different geographies, using a CDN will very likely make a big difference in how fast pages with SharePoint Framework solutions load. If done correctly, subsequent requests will be served from local cache but optimizing that first request, will help you ensure that your pages load fast every time.
Organizations located in one geography can still benefit of using a CDN, but for reasons different than its global file distribution system.
Benefit of using a CDN, even in a single geography
Recently I wrote about configuring Azure Blob Storage for delivering SharePoint Framework assets as quickly as possible. In the article, I mentioned how some settings can be applied directly to Azure Blob Storage, but others require enabling Azure CDN. Azure CDN isn’t free. Yet, setting it up and operating it, is very convenient. If your organization is located in a single geography, unless you already have a server that you use for hosting static assets, using Azure CDN will be more cost efficient than any other alternative. The same is very likely to be true for other CDN providers.
High performance without a CDN
If your users aren’t distributed around the globe, and you do have an existing infrastructure, be sure that it’s configured correctly for serving static assets. With little to none additional effort, you will be able to achieve great results without incurring additional costs for using a CDN.