Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

naykel's avatar

Build and deploy site

Currently, I build locally then push to my repo. To make this work I removed /public/build from .gitignore. However, knowing the Laravel team are much smarter than me I am sure they have this build folder in the .gitignore for a reason.

What is the best practice for building and deploying a Laravel site with vite? Should I install npm on my server and build or is it ok to handle locally and push like I am?

0 likes
7 replies
naykel's avatar

@jlrdw I use forge and I don't have any problems getting my Laravel sites to run, I just want to know if I should be building my production sites on my server.

jlrdw's avatar

@naykel There is a free series on forge. I don't use forge. But normally you pull your Github or staging to production and install the framework there among other commands.

But look over the free video series.

Edit:

Also look at the deployment chapter.

martinbean's avatar

@naykel The public/build directory is ignored from version control because you’re meant to run npm install and npm run build on your server when deploying your site.

1 like
Snapey's avatar

the idea is to run the build in your CI/CD pipeline. I would never build on the production server.

But, it's personal preference, I do exactly as you

naykel's avatar

@Snapey Thank you, I think this is what I needed to hear. It’s so easy to overthink things and find yourself stuck in a loop of doubt when you don’t fully understand something.

Please or to participate in this conversation.