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

Rocky's avatar
Level 1

Vite not copying images to public

Hello,

i'm new to Laravel 10.

Trying to copy my images from /resources/img to /public/img.

vite.config.js import { defineConfig, normalizePath } from 'vite'; import laravel from 'laravel-vite-plugin'; import path from 'path'; import { viteStaticCopy } from 'vite-plugin-static-copy';

	export default defineConfig({
		plugins: [
    		laravel({
        		input: [
            		'resources/sass/app.scss',
            		'resources/js/app.js',
        		],
        		refresh: true,
    		}),
			viteStaticCopy({
        		targets: [
            		{
                		src: normalizePath(path.join(__dirname, '/resources/img/**/*')),
                		dest: normalizePath(path.join(__dirname, '/public/img'))
            		},
        		],
    		}),
		],
		resolve: {
    		alias: {
        		'~fa': path.resolve(__dirname, 'node_modules/font-awesome/scss'),
    		}
		}
	});

Referencing in Blade: img src="{{ asset('img/Logo.png') }}" alt="Logo"

0 likes
1 reply

Please or to participate in this conversation.