Why is your public directory named static? Maybe it would help if you explained your laravel project structure?
Jul 15, 2022
8
Level 9
Laravel Vite Js change of public directory
Hi Everyone, I can't seem to figure out the inner workings of vite js while trying to migrate from laravel mix. My config looks like that
export default defineConfig({
server: {
https: {
key: fs.readFileSync('src/ssl/localhost.key'),
cert: fs.readFileSync('src/ssl/localhost.crt'),
},
host: 'localhost',
},
plugins: [
laravel(
{
publicDirectory: 'static',
input: [
'src/scss/app.scss',
'src/js/app.js',
],
}),
],
});
Where on dev server will be prebundelled app.css and app.js be located?
https://localhost:5173/@vite/client -> works
https://localhost:5173/static/css/app.css -> does not work
https://localhost:5173/static/js/app.js -> does not work
https://localhost:5173/resources/css/app.css -> does not work
https://localhost:5173/resources/js/app.js -> does not work
https://localhost:5173/css/app.css -> does not work
https://localhost:5173/js/app.js -> does not work
https://localhost:5173/static/build/assets/css/app.css -> does not work
https://localhost:5173/static/build/assets/js/app.js -> does not work
https://localhost:5173/src/scss/app.scss -> returns source file
https://localhost:5173/src/js/app.js -> returns source file,
It seem to be pulling all the static files from the directory, but not prebundled ones from dev server.
Please or to participate in this conversation.