Introduction
We have seen in many articles the steps on how to run SharePoint Framework (SPFx) web parts in local Workbench. However, that is not how users expect to use the web parts; they want them to install those web-parts in a real-time scenario.
Please read my previous articles on SPFx.
Let’s get started.
- ReactJS Fundamentals - Zero To Hero Series - Part One
- React Components - Zero To Hero Series - Part Two
- Introduction To JSX And Rendering Elements - Zero To Hero Series - Part Three
We know that by default the project templates render everything from Localhost. However, for our build and production purpose, that is not going to work and ultimately, we need to use CDNs (Content Delivery Network).
We will start from an SPFx web part that works in a local workbench and will bundle the solution using a command called "gulp package-solution" which works only in debug mode. If we want to bundle for the production environment, then we need to use the command "gulp package-solution --ship".
So, how we can deploy the web part in Office 365 tenant? The answer to this question is that we need to create a package file and that package file needs to be uploaded in the App Catalog.
Step 1

Step 2

Step 3



Step 4


Step 5


Step 6

Click on the above app and it will redirect you to a modern page where all lists and libraries will be displayed. The app will take a few minutes to get deployed to the site collection.

Step 7

In my case, the web part was present in "Others" category, as shown below,

Step 8

Step 9

General Tip
When you click on the Technical details of the above error message, you will see the below details. So, you can run the command "gulp trust dev-cert", however, the tip here is - Do not use Firefox or any other browser for testing. Use only Google Chrome browser, else you will not see the desired output.

Summary
In this article, we look into the steps of how we can bundle and deploy SharePoint Framework web parts to Office 365.
参考网站:
https://www.c-sharpcorner.com/article/deploying-and-shipping-sharepoint-framework-spfx-web-parts2/