Deployment
In this section you will learn about how to deploy your application on the live server. Please read the documentation carefully.
Last updated
In this section you will learn about how to deploy your application on the live server. Please read the documentation carefully.
Last updated
To create a production build you need to run the command npm run build
. It will create the dist
folder, that contains the production build files. Now you just need to upload the dist
files on to the server.
For environments using , the easiest way to handle this would be to install and let it handle the rest:
You don’t necessarily need a static server in order to run a project in production. It works just as fine integrated into an existing dynamic one.
Here’s a programmatic example using and :
Apache HTTP server:
Upload the dist
files in the public folder.
If you want to make your production build in different folder or sub directory. Like, if you want that the template run on the test.com/dist
rather then test.com
then you need to follow the steps given below:
Step 1: Open .webpack.config.js
file and search for
and set your path as per requirement like:
Step 2: Now go to src>App.js
file and set the Router basename
to dist
like following code:
Step 3: Open .htaccess
file and set the roots for subdirectory: We have added the screenshot for the .htaccess
file location and also the code of the file.
If you’re using , you need to create a .htaccess
file in the public
folder that looks like this: