Skip to content

Commit 75690b5

Browse files
authored
Vue 3 in Laravel 11
How To Install Vue 3 in Laravel with Vite (router, i18n translation, pinia store).
1 parent 53163c5 commit 75690b5

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,28 +110,32 @@ createApp(App).mount("#app")
110110
</html>
111111
```
112112

113-
### .env
114-
115-
```sh
116-
APP_URL=http://localhost:8000
117-
```
118-
119113
### routes/web.php
120114

121115
```php
122116
<?php
117+
// Laravel routes
118+
// ...
123119

124-
// Last route
125-
Route::fallback(function() {
120+
// Vue routes
121+
Route::get('/', function () {
126122
return view('welcome');
127123
});
124+
125+
// Vue Last route
126+
if (!app()->runningUnitTests()) {
127+
Route::fallback(function() {
128+
return view('welcome');
129+
});
130+
}
128131
```
129132

130133
### Build and run
131134

132135
```sh
133136
npm run build
134137
php artisan serve
138+
php artisan serve --host=localhost --port=8000
135139
```
136140

137141
## Override /build dir in page url (errors)
@@ -144,6 +148,13 @@ history: createWebHistory('/')
144148
base: './',
145149
```
146150

151+
## App url in .env
152+
153+
```sh
154+
# Dev server only
155+
APP_URL=http://localhost:8000
156+
```
157+
147158
## Links
148159

149160
- <https://router.vuejs.org/guide>

0 commit comments

Comments
 (0)