Did you add Vue?
Jul 2, 2022
20
Level 1
Vite with Laravel and Vue 3 show blank screen
I installed Laravel 9 and Vue 3. But when the Vue is mounted, all the elements inside the app are removed. vite.config.js:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel([
'resources/css/app.css',
'resources/js/front.js',
]),
],
});
front.js:
import { createApp } from 'vue'
const app = createApp({
data() {
return {
count: 0
}
}
})
app.mount('#app')
master.blade.php:
<!DOCTYPE html>
<html>
<head>
@vite('resources/js/front.js')
<title>test</title>
</head>
<body>
<div id="app">
<div>test</div>
<button @click="count++">@{{ count }}</button>
</div>
</body>
</html>
postcss.config.js:
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
result:
<body>
<div id="app" data-v-app=""><!----></div>
</body>
Level 1
@MohamedTammam I followed this link:
https://github.com/fengyuanchen/vue-feather/issues/8
and replace
import {createApp} from 'vue'
with:
import { createApp } from 'vue/dist/vue.esm-bundler';
Now there is no need to alias. However, this point is not in the document.
11 likes
Please or to participate in this conversation.

