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

Nick-'s avatar
Level 8

Content disappears vite production

I made the transition from mix to Vite, the development part works as expected, but as soon as I run the production command all the content disappears from the page.

On page load the content is visible for a split second. I am pretty sure it has something to do with Vue (v3). When I remove id="app" (what I have set for vue to mount to) from the main div the page loads and content is visible.

vite.config.js

import { defineConfig } from "vite";
import laravel from "laravel-vite-plugin";
import vue from "@vitejs/plugin-vue";

export default defineConfig({
    build: {
        rollupOptions: {
            output:{
                manualChunks(id) {
                    if (id.includes("node_modules")) {
                        return id.toString().split("node_modules/")[1].split("/")[0].toString();
                    }
                }
            }
        }
    },
    plugins: [
        laravel({
            input: [
                "resources/css/app.css",
                "resources/js/app.js",
            ],
            refresh: true,
        }),
        vue({
            template: {
                transformAssetUrls: {
                    // The Vue plugin will re-write asset URLs, when referenced
                    // in Single File Components, to point to the Laravel web
                    // server. Setting this to `null` allows the Laravel plugin
                    // to instead re-write asset URLs to point to the Vite
                    // server instead.
                    base: null,

                    // The Vue plugin will parse absolute URLs and treat them
                    // as absolute paths to files on disk. Setting this to
                    // `false` will leave absolute URLs un-touched so they can
                    // reference assets in the public directory as expected.
                    includeAbsolute: false,
                },
            },
        }),
    ],
});
0 likes
2 replies
Nick-'s avatar
Level 8

This issue has been resolved. For those with the same issue, add the following to your defineConfig:

resolve: {
        alias: {
            vue: "vue/dist/vue.esm-bundler.js",
        },
    },
1 like

Please or to participate in this conversation.