skip to Main Content

I have built my react js app with create-react-app configs and it works fine in development build of React.
I built that with npm build command and now i have build folder.
this web page is static (server-less), Now I want to know how to use that and where put files in Cpanel.

2

Answers


  1. After the bundle realized by webpack, you can check the transpiled and minified version inside the build folder. You should upload all the content to your public_html or another folder.

    And the meaning of server-less is totally different than you’re using. Check this article to understand what it is: What is serverless.

    Login or Signup to reply.
  2. I do not use CRA boilerplate since i have my own but in your case, you should find where your js bundle is. You can find the bundle location in the webpack config. Then append that to your html somehow like this:

    <div id="root"></div>
    <script src='your-js-bundle'></script>
    

    Assuming that somewhere in your code, you are appending your js code into a div like this:

    const element = <h1>Hello, world</h1>; // assuming element is your entry point
    ReactDOM.render(element, document.getElementById('root'));
    

    That works if its just simple react project your working on (No SSR and such)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search