Before you can deploy your React application, you need to build the application using Parcel
(https://parceljs.org).
Parcel
generates the final HTML, CSS, and JS files and save them in the dist
folder.
Please execute the following commands inside the example folder.
- Initialize the project:
npm init -y
- Add the following line to the
package.json
file:"source": "index.html",
. This is the souce file that contains your application. - Install the
parcel
build tool:sudo npm install -g parcel --save-dev
- Install the necessary React libraries:
npm install react react-dom react-router-dom
- Build the application using the
parcel
command. This command also runs a local server for previewing your Web application:parcel
- To preview the application within your Google Cloud Worksatation, duplicate the Tab and then change the port number to the one shown by
parcel
. - To generate the
FINAL
HTML, CSS, and JS files, run the following command:parcel build
. The files will be saved in thedist
folder. - To teset your
FINAL
application, terminate theparcel
server. After that, change directory to the folderdist
. Inside this folder, run the following command:python3 -m http.server
. - To preview the final application within your Google Cloud Worksatation, duplicate the Tab and then change the port number to the one shown by the
python
built-in server. - You deploy the files in the folder
dist
.
=================== Notes ============================
Inside CodeSpaces [Specify Port Number]: python3 -m http.server 1234