In prior versions of Laravel, I moved code with custom JS files into webpack.mix.js. Is there a way to make a similar one in Laravel 9, which uses vite.config.js?
mix.copy('resources/js/custom-file.js', 'public/js/').version();
I modified file vite.config.js:
import { viteStaticCopy } from 'vite-plugin-static-copy'
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,
}),
viteStaticCopy({
targets: [
{
src: 'resources/js/feedback.js',
dest: 'js/custom.js'
}
]
})
],
});
That helped me with my issue...