#How do I deploy with vite!!
30 messages · Page 1 of 1 (latest)
Sorry but I got frustrated with the docs and how resources mostly consists of old versions
What do you mean "resources consists of old versions"?
Stackoverflow youtube etc
The default Vite-directive handles the production build case as well, you should not replace these with your own script tags
Is that written inn the docs?
Yes, it's all written in the docs; https://laravel.com/docs/10.x/vite#loading-your-scripts-and-styles
The
@vitedirective will automatically detect the Vite development server and inject the Vite client to enable Hot Module Replacement. In build mode, the directive will load your compiled and versioned assets, including any imported CSS.
lol my mistake sorry
So Laravel has been popular for a while, which means that there are resources for older version, and that is a bad thing?
Since you are more expert than me is there a way to automate migration procedures? In dotnet for example it would detect changes and automatically drop or make new fields, update keys etc...
php artisan migrate will automatically run any new migrations
Yoou need to run php artisan make:migrate then manually drop make new fields, right?
No, you're probably referring to Entity Framework, Laravel doesn't have such a thing
yes exactly
too bad
Do you use Eloquent or other framework?
Laravel comes bundles with Eloquent, why wouldn't you use that..? If you're not going to use that you're basically just fighting the framework with little to no benefit
Dotnet isn't Laravel, there are just going to be differences
@gleaming sand do I need to change the directive or not ========
Do I need to remove resources/css/app.css??
IIsnn't there a way for it to detect its on production?
Change it to what..? Follow the docs, then Laravel will automatically detect it. If the Vite dev server isn't running it'll assume you've ran the build. So you probably haven't done that
You just use @vite('resources/js/app.css'), nothing more (as per the docs)
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
input: [
'resources/sass/app.scss',
'resources/js/app.js',
],
refresh: true,
}),
],
});
Do I need to change the configs??
Well yeah, you have resources/sass/app.scss there, while in your blade template you're trying to use resources/css/app.css