We have seen about webpart creation and getting list items from SharePoint in last two articles. Now we are going see about hosting the packages and bundles of webpart. Click the following URL to touchbase about webpart creation and populating listitems.
First set CDN path for bundle reference. We have to upload the dependency files in that folder. It must be a SharePoint library folder. I am creating one folder for this in Site Assets.
First set CDN path for bundle reference. We have to upload the dependency files in that folder. It must be a SharePoint library folder. I am creating one folder for this in Site Assets.
Mention this path in write-manifest.json file which is under config folder.
Path will be like: https://YoursiteUrl/SiteAssests/deploy
If you need to change the properties of package like name, version and zippedpackage. you have to change in package-solution.json file.
We have done all things in solution side. Next we need to create a package using gulp command.
Open the Command Prompt and go to solution path. Run the below command to get the build.
- gulp clean (This command used to clean bundles which is created previously)
- gulp --ship
- gulp bundle --ship (This command used to create bundles)
- gulp package-solution --ship (This command used to make package)
Each command will take some time to execute. We can see the package in SharePoint folder.
Bundles will be created in temp --> deploy folder.
Upload the sppkg file in AppCatalog Site. Above 3 dependency files must be uploaded at CDN path. Webpart will be available in you site once it is uploaded in AppCatalog. We can add this like adding app. You can see the webpart while click the add webpart in the page.
No comments:
Post a Comment