Lompat ke konten Lompat ke sidebar Lompat ke footer

Cara pasang bootstrap pertama kali di laravel 10


composer require laravel/ui --dev


php artisan ui bootstrap --auth


npm install bootstrap-icons --save-dev


npm install


npm run build 



Solved

Step 1: vite.config.js

Vite works best without CSS entry points:

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
 
export default defineConfig({
plugins: [
laravel([
'resources/css/app.css',
'resources/js/app.js',
]),
],
});

Step 2: resources/js/app.js

Instead, you should import your CSS via JavaScript. Typically, this would be done in your application's resources/js/app.js file:

import './bootstrap';
import '../css/app.css';

Step 3: Layouts

If you're importing your CSS via JavaScript, you only need to include the JavaScript entry point:

<!doctype html>
<head>
{{-- ... --}}
 
@vite('resources/js/app.js')
</head>

Step 4: Build

Running the build command will version and bundle your application's assets and get them ready for you to deploy to production:

# Build and version the assets for production...
npm run build

Well done!

php artisan optimize:clear
close