Seems as you have hard coded urls.
Sep 15, 2022
13
Level 1
Laravel vite deployment not working
Hello,
I am deploying a website that I created with laravel 9 and vite. I run npm run build in my development server and then transfer the files over ftp to the production server, however, the @ vite directive doesn`t work and it links the files to 127.0.0.1:5173 and not the servers url. How can I fix this?
How I call the @ vite directive:
@viteReactRefresh
@vite(['resources/sass/app.scss', 'resources/js/index.tsx'])
How it renders in HTML
<script type="module" src="127.0.0.1:5173/@vite/client"></script>
<link rel="stylesheet" href="127.0.0.1:5173/resources/sass/app.scss" />
<script type="module" src="127.0.0.1:5173/resources/js/index.tsx">
The error I get on production:
GET 127.0.0.1:5173/resources/sass/app.scss net::ERR_CONNECTION_REFUSED
vite.config.js:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [
react(),
laravel({
input: [
'resources/sass/app.scss',
'resources/js/index.tsx',
],
refresh: true,
}),
],
});
Level 102
Sounds like you accidentally transfered the file hot in the public directory. Delete it and it should work
The file is used when running the dev server but will break production
33 likes
Please or to participate in this conversation.