laravel / vite-plugin

Laravel plugin for Vite.
MIT License
799 stars 151 forks source link

public to public_html #74

Closed zdarin closed 2 years ago

zdarin commented 2 years ago

Hello,

Can some one explain what im doing wrong Im working with shared hosting and when public folder renamed for public_html writes error can someone explain how correctly change without errors? Or its seems to be fixed ??

By npm run dev throws errors but seems working Or i need public folder exist too for laravel vite to work and public_html for host ?

check
timacdonald commented 2 years ago

You should not use Vite's publicDir config, as that has a different purpose. Instead you may set the publicDirectory for the Laravel Plugin.

// ...

laravel({
    input: "resources/js/app.js",
    publicDirectory: "public_html",
}),

// ...
zdarin commented 2 years ago

Thx its fixed this with public error but in browser i have error

Failed to load resource: the server responded with a status of 500 ()

I think somthing with manifest / assests it should be ??

timacdonald commented 2 years ago

With that information I'm not sure what the issue is or if it is related to the vite plugin or not.

Haris-Rahat-Dev commented 2 years ago

image

guys i have an issue when deploying a Inertia Laravel app, the issue is that i move the public folder's files from the larvel project to the public_html folder of the hosting, but this error occurs, is there a way to tell vite to look for the build folder in the public_html folder outside of laravel's directory?

zdarin commented 2 years ago

delete config file on Hosting server from

bootstrap\cache\config.php

Haris-Rahat-Dev commented 2 years ago

delete config file on Hosting server from

bootstrap\cache\config.php

yes i did that

Haris-Rahat-Dev commented 2 years ago

idk why mine doesn't work, The Vite.php file is looking in the public folder of the laravel(folder structure that is in development)

jessarcher commented 2 years ago

@Rage-coder69, you need to tell Laravel where your new public directory is. You can do this in the register method of a service provider:

$this->app->bind('path.public', function () {
    return base_path('public_html');
});
Haris-Rahat-Dev commented 2 years ago

@Rage-coder69, you need to tell Laravel where your new public directory is. You can do this in the register method of a service provider:

$this->app->bind('path.public', function () {
    return base_path('public_html');
});

yes thank you for your reply, i had to tell laravel my new public directory and had to update the code in the core files, and after that tweaking, the website starting working.

timacdonald commented 2 years ago

Hey folks, I just removed some comments here as they were exposing your servers file structure and it could be a potential security risk.

Just better to be safe than sorry 🔐