motinska94's avatar

Vite showing [::1]:5173 url in production, the page has no styling at all

I don't know what went wrong, the site was working fine, I left for an hour and came back to see all my styling disappeared.

I'm using @vite(['resources/css/app.css', 'resources/js/app.js']) to include the files, but on the website, network tab shows 3 failed requests to these URLs :

http://[::1]:5173/@vite/client
http://[::1]:5173/resources/css/app.css
http://[::1]:5173/resources/js/app.js

my vite.config.js file was like this (default) :

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        laravel({
            input: [
                'resources/css/app.css',
                'resources/js/app.js',
            ],
            refresh: true,
        }),
    ],
});

Chatgpt told me to change it to this :

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        laravel({
            input: [
                'resources/css/app.css',
                'resources/js/app.js',
            ],
            refresh: true,
        }),
    ],
    build: {
        manifest: true,  // Generates a manifest file for Laravel to use
        outDir: 'public/build',  // Output directory for production assets
        rollupOptions: {
            output: {
                entryFileNames: 'assets/[name].js',
                chunkFileNames: 'assets/[name].js',
                assetFileNames: 'assets/[name].[ext]',
            },
        },
    },
});

it didn't work either. And I've done route, view, cache clear and npm run build like a billion times.

Site url in case you want to see it yourself : teknot.com.tr

1 like
4 replies
motinska94's avatar
motinska94
OP
Best Answer
Level 3

I solved it by removing public/hot file, and running npm install && npm run build

11 likes
pmx's avatar

@motinska94 This sent me in the right direction to solve it for my case. I was trying to build my app as a docker image but had vite running locally. This was causing the built image to attempt to load the vite client in dev mode! killing my local vite removed the hot file and fixed my issue so thank you!

1 like

Please or to participate in this conversation.