No Build folder

Viewed 35

I'm using a parcel bundler instead of a react-scripts which uses npm run build-prod instead of npm run build but it doesn't create a build folder instead they all in a dist folder so i changed the deploy script in the package.json to "deploy": "gh-pages -d dist" instead of the standard "deploy": "gh-pages -d build" which will give an error saying build script is missing , after i tried deploying this to git hub pages but i get an empty screen

 "scripts": {
 "predeploy": "npm run build-prod",
 "deploy": "gh-pages -d dist",
 "clean": "rm dist/bundle.js",
 "start": "parcel src/index.html",
 "build-prod": "parcel build src/index.html"
},
"dependencies": {
 "node-sass": "^7.0.1",
 "react": "^18.2.0",
 "react-dom": "^18.2.0",
 "react-router-dom": "^6.3.0"
},
"devDependencies": {
 "@babel/core": "^7.18.5",
 "@babel/preset-env": "^7.18.2",
 "@babel/preset-react": "^7.17.12",
 "gh-pages": "^4.0.0",
 "parcel-bundler": "^1.12.5",
 "prettier": "^2.7.1"
}
1 Answers

According the the Parcel docs here, you need to specify the --dist-dir flag.

Change your "build-prod" script to this:

"build-prod": "parcel build src/index.html --dist-dir build"

Now the output directory for your parcel build will go to build instead of dist so you can change your "deploy" script back to this:

"deploy": "gh-pages -d build"
Related