javascriptreactjsparcelbluehost

How can I deploy my react app with parcel bundler to Bluehost server?


So I am attempting to deploy an application built with React and Parcel JS bundler. My question is, if it is not being deployed to Github-pages, but to a server like "BlueHost" for example, Do I upload the "Dist" folder that Parcel bundles after parcel build command?

If so can someone explain how the process works after the "dist" folder is uploaded. How is it able to find "index.html" .

I am just trying to put a react and parcel project onto my portfolio website which is hosted on (BLueHost), don't want to use Github-pages for this particular project.

Hope that made sense? Thanks!


Solution

  • Assuming all the files necessary for your web app are in the dist directory, then yes, that's what you would upload. You will need to serve them with a web server. You could either write a simple server yourself, like this Node example:

    const express = require('express')
    const app = express()
    
    app.use(express.static(__dirname + '/dist'))
    app.listen(8000, () => { console.log('listening') })
    

    Or you could use an existing web server like Nginx, Apache, or Caddy, which you would need to install and configure on your server. Files sitting on a server aren't accessible unless there's a process actually serving them up on a port accessible to the web.

    This tool is from DigitalOcean, but is very useful and should help you if you decide to use Nginx on BlueHost.