Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

neDiaz's avatar

How Vite is configured with Laravel and Vue. Blank Page

I'm trying to configure a project using Laravel 9 + Vita + Vue. I'm stuck in the same place with the blank page. I checked in the console and vue code is not loading. Trying differents, ways, set alias, update the apps.js, nothing works

"private": true,
    "scripts": {
        "dev": "vite",
        "build": "vite bumpild && vite build --ssr"
    },
    "devDependencies": {
        "@inertiajs/inertia": "^0.11.0",
        "@inertiajs/inertia-vue3": "^0.6.0",
        "@inertiajs/progress": "^0.2.7",
        "@tailwindcss/forms": "^0.5.2",
        "@vitejs/plugin-vue": "^2.3.3",
        "autoprefixer": "^10.4.2",
        "axios": "^0.25",
        "lodash": "^4.17.19",
        "postcss": "^8.4.6",
        "tailwindcss": "^3.1.0",
        "vue": "^3.2.31",
        "vue-loader": "^16.8.3"
    },
    "dependencies": {
        "@babel/plugin-syntax-dynamic-import": "^7.8.3",
        "@popperjs/core": "^2.11.5",
        "laravel-vite-plugin": "^0.3.0",
        "madge": "^5.0.1",
        "resolve-url-loader": "^5.0.0",
        "sass": "^1.53.0",
        "sass-loader": "^13.0.2",
        "survey-vue": "^1.9.38",
        "vite":"^2.9.14",
        "vue-template-compiler": "^2.7.4"
    }
} 

vite.config.js

export default defineConfig({
    plugins: [
        laravel(['resources/js/app.js']),
        vue({
            template: {
                transformAssetUrls: {
                    base: null,
                    includeAbsolute: false,
                },
            },
        }),
    ],
    resolve: {
        alias: {
            '@': '/resources/js',
            vue: 'node_modules/vue/dist/vue.esm-bundler.js',
        },
    },
});

app.js

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

import { createApp, h } from '/node_modules/vue/dist/vue.esm-bundler.js';
import { createInertiaApp } from '@inertiajs/inertia-vue3';
import { InertiaProgress } from '@inertiajs/progress';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import { ZiggyVue } from '../../vendor/tightenco/ziggy/dist/vue.m';


createInertiaApp({
  resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')),
  setup({ el, App, props, plugin }) {
    createApp({ render: () => h(App, props) })
      .use(plugin)
      .mount(el)
  },
});

InertiaProgress.init({ color: '#4B5563' });
0 likes
4 replies
Sinnbeck's avatar

Hit f12 and check the console for errors. Or is it blank?

1 like
neDiaz's avatar

@Sinnbeck No error, nothing in the console: console

[vite] connecting...
[vite] connected.

Elements

<div id="app" data-page="{&quot;component&quot;:&quot;Welcome&quot;,&quot;props&quot;:{&quot;errors&quot;:{},&quot;auth&quot;:{&quot;user&quot;:null},&quot;ziggy&quot;:{&quot;url&quot;:&quot;http:\/\/dreimmoapp.test&quot;,&quot;port&quot;:null,&quot;defaults&quot;:[],&quot;routes&quot;:{&quot;ignition.healthCheck&quot;:{&quot;uri&quot;:&quot;_ignition\/health-check&quot;,&quot;methods&quot;:[&quot;GET&quot;,&quot;HEAD&quot;]},&quot;ignition.executeSolution&quot;:{&quot;uri&quot;:&quot;_ignition\/execute-solution&quot;,&quot;methods&quot;:[&quot;POST&quot;]},&quot;ignition.updateConfig&quot;:{&quot;uri&quot;:&quot;_ignition\/update-config&quot;,&quot;methods&quot;:[&quot;POST&quot;]},&quot;survey.index&quot;:{&quot;uri&quot;:&quot;dashboard&quot;,&quot;methods&quot;:[&quot;GET&quot;,&quot;HEAD&quot;]},&quot;survey.run&quot;:{&quot;uri&quot;:&quot;survey\/run&quot;,&quot;methods&quot;:[&quot;GET&quot;,&quot;HEAD&quot;]},&quot;register&quot;:{&quot;uri&quot;:&quot;register&quot;,&quot;methods&quot;:[&quot;GET&quot;,&quot;HEAD&quot;]},&quot;login&quot;:{&quot;uri&quot;:&quot;login&quot;,&quot;methods&quot;:[&quot;GET&quot;,&quot;HEAD&quot;]},&quot;password.request&quot;:{&quot;uri&quot;:&quot;forgot-password&quot;,&quot;methods&quot;:[&quot;GET&quot;,&quot;HEAD&quot;]},&quot;password.email&quot;:{&quot;uri&quot;:&quot;forgot-password&quot;,&quot;methods&quot;:[&quot;POST&quot;]},&quot;password.reset&quot;:{&quot;uri&quot;:&quot;reset-password\/{token}&quot;,&quot;methods&quot;:[&quot;GET&quot;,&quot;HEAD&quot;]},&quot;password.update&quot;:{&quot;uri&quot;:&quot;reset-password&quot;,&quot;methods&quot;:[&quot;POST&quot;]},&quot;verification.notice&quot;:{&quot;uri&quot;:&quot;verify-email&quot;,&quot;methods&quot;:[&quot;GET&quot;,&quot;HEAD&quot;]},&quot;verification.verify&quot;:{&quot;uri&quot;:&quot;verify-email\/{id}\/{hash}&quot;,&quot;methods&quot;:[&quot;GET&quot;,&quot;HEAD&quot;]},&quot;verification.send&quot;:{&quot;uri&quot;:&quot;email\/verification-notification&quot;,&quot;methods&quot;:[&quot;POST&quot;]},&quot;password.confirm&quot;:{&quot;uri&quot;:&quot;confirm-password&quot;,&quot;methods&quot;:[&quot;GET&quot;,&quot;HEAD&quot;]},&quot;logout&quot;:{&quot;uri&quot;:&quot;logout&quot;,&quot;methods&quot;:[&quot;POST&quot;]}},&quot;location&quot;:&quot;http:\/\/dreimmoapp.test&quot;},&quot;canLogin&quot;:true,&quot;canRegister&quot;:true,&quot;laravelVersion&quot;:&quot;9.19.0&quot;,&quot;phpVersion&quot;:&quot;8.1.7&quot;},&quot;url&quot;:&quot;\/&quot;,&quot;version&quot;:&quot;de902d9b73e9ab8693281af7cca81941&quot;}"></div>
1 like
Slaty's avatar

maybe vue: 'vue/dist/vue.esm-bundler.js',

Please or to participate in this conversation.