I made a react project, using babel and webpack. After transpiling the main.jsx(my jsx file name) using Babel, i used the command 'npx webpack' i got the main.js file as well as the output but when i upload the main.js ,index.html and style.css in github the page is not working. Please tell me the steps i need to perform and also if webpack production will fix this?
Asked
Active
Viewed 31 times
1 Answers
1
to build for production you need to run this command
npm run build
inside your project folder,
which will create a new folder called "dist" that will contain all your production code.
you can check the react documentation for more information about this step,
https://create-react-app.dev/docs/production-build/
then, upload it to GitHub you can follow these steps
How to upload a project to GitHub
keep in mind that files that you upload must be in the same structure tree as in the dist folder for example: if it is like this:
dist/index.html
dist/assets/index.css
dist/assets/index.js
you can't upload it to GitHub (if you will upload it manually not using Git) as this:
index.html
index.css
index.js
you must keep the tree structure as in the dist folder.

Abdelrahman Khallaf
- 379
- 3
- 10