0

Vite "npm run build" creates files in the public directory of development environment as follows:

-build

---- assets

--------app.css

--------app.js

----manifest.json

----index.php

----robots.txt

----.htaccess

I do not understand where to put these files on production server (Apache).

Also, I do not understand how these files relates to Laravel deployment.

I have searched Stackoverflow and the web, but mainly I found deployment descriptions for automated deployments involving third party services (Heroku, Digitalocean etc.).

1 Answer 1

1

In short, the "build" is the compiled lite version of assets. this build folder never pushes to the server. it must compile during the deployment. therefore you have to make sure npm run build is available on your deployment hooks.

Since the build is exposed to the public, you don’t need to move it elsewhere. Keep it as default.

Just use the Vite helper to link assets in your blade files.

Ex:

@vite(['resources/css/app.css', 'resources/js/app.js'])

If you use different assets, make sure to add those in the vite.config.js

Ex:

input: [
    'resources/css/app.css',
    'resources/js/app.js',
    //add extra source files in here
],

Tip: For deploy the application you may use Laravel Envoy

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you! So, all in all, does it mean, that I simply deploy the inertia-vite project as normal Laravel project on Apache, the run 'npm install' and good to go?
I do not understand how the 'resources' folder is indicated on production? There is no 'resources' folder, isn't it?
@TamásLászló The resources folder will be there. Once you push the code to the server, Run npm run build to build assets.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.