I am using laravel-modules package, When i try to use Vite::asset through the layout/master.blade.php then it works and looking to the relative manifest i.e. public/build-pages/. but it is not working to other blade templates.
My module structure is
- /Modules/Pages/Resources/views/
- /Modules/Pages/Resources/views/layouts/master.blade.php
- /Modules/Pages/Resources/views/index.blade.php
Vite Configuration:
const dotenvExpand = require('dotenv-expand');
dotenvExpand(require('dotenv').config({ path: '../../.env'/*, debug: true*/}));
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import path from 'path';
export default defineConfig({
build: {
outDir: '../../public/build-pages',
emptyOutDir: true,
manifest: true,
},
plugins: [
laravel({
publicDirectory: '../../public',
buildDirectory: 'build-pages',
input: [
__dirname + '/Resources/assets/sass/app.scss',
__dirname + '/Resources/assets/js/app.js'
],
refresh: true,
}),
],
resolve: {
alias: {
'~bootstrap': path.resolve(__dirname, 'node_modules/bootstrap'),
}
},
});
Issue in file:
- /Modules/Pages/Resources/views/index.blade.php
<img src="{{ Vite::asset('Resources/assets/images/xyz.svg') }}">
Error: Vite manifest not found at: /var/www/html/public/build/manifest.json
because it is looking to wrong manifest that should be /var/www/html/public/build-pages/manifest.json
How do i fix this issue?