Home > database >  How to give next js app build to the client
How to give next js app build to the client

Time:10-30

I am new on Next JS, I have created a small application. It is using API calls and more features. During development, Using the command as npm run build I am able to create .next folder as build and using npm run start I am able to run that build.

Now the client is asking for build, so what should I send to him? Either complete project and ask him to do the npm run build and npm run start (which I don't think so) or only the .next folder. But how he will run this build?

CodePudding user response:

Some possible ways of sharing your project:

  • You can easily build and host your project with services like vercel or netlify. Easy and quick. Check out the vercel CLI in particular.

  • Your client can clone the git repo, install all dependencies, run build, and run start. This'll start a production server. Check here: https://nextjs.org/docs/api-reference/cli#production. Bad idea if your client is not a dev.

  • You can build your project and send the output to your client, which he/she can then view by spinning up a server (python simpleHTTPServer, Mamp). Also a bad idea if your client is not a dev.

Long story short, host your project somewhere and send them a production URL.

CodePudding user response:

  1. Open package.json in your editor and add the following export script to the file:

    "export": "npm run build && next export -o _static"
    
  2. run this code in the terminal:

    npm run export
    
  3. Open _static folder and there is all of your file.

  • Related