Akhil Arelli
Akhil Arelli

Reputation: 31

How to host a sample React Application in Sharepoint online?

created a sample react application which is running in localhost:3000. Now i need to host the same react application in sharepoint online. Any solutions to this.

Upvotes: 0

Views: 1194

Answers (1)

Jerry
Jerry

Reputation: 3615

Please check the steps in the blog below:

Build And Deploy The Client Side Web Part (SPFx) In SharePoint Online

1) Once you are done with the your local development, we need to configure a CDN path where we can host our files.

Go to the config > write-manifests.json file.

Here, enter your CDN path. It should be a path that can be accessible by the end users. It could be Azure or SharePoint or any thing else.

Modify it as below (sample code) and save the file:

{

"$schema": "https://dev.office.com/json-schemas/spfx-build/write-manifests.schema.json",

"cdnBasePath": ""

}

2) Now, you need to generate the files to be deployed.

For that run the below command:

gulp bundle –-ship After this is done, you will find the a temp > deploy folder inside your solution as below: enter image description here

Once this is generated, upload all the files inside the deploy folder to your CDN or Site Assets (as in our case). This task can also automated using advanced gulp tasks.

3) Now, we will create spapp file to be uploaded to app catalog.

For that, run the below command:

gulp package-solution –-ship This will generate an sppkg file inside sharepoint folder as below: enter image description here

Upload it to the app catalog. SharePoint will show you a popup and ask you to trust the client-side solution to deploy.

Click Deploy.

After that, you can add it like you add an App in a SharePoint site.

Upvotes: 1

Related Questions