how use js asset in Laravel 9^ project?

Viewed 18

I added the react library to my Laravel (9.3) project but when I run the project it catch the following error in console.

Error: GET http://127.0.0.1:8000/js/app.js net::ERR_ABORTED 404 (Not Found).

<script src="{{asset('js/app.js') }}" defer></script>
@viteReactRefresh
@vite('js/app.js')

the above script does not work for me

vite.config.js file:

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import react from '@vitejs/plugin-react';

export default defineConfig({
    plugins: [
        laravel({
            input: [
                'resources/sass/app.scss',
                'resources/js/app.js',
            ],
            refresh: true,
        }),
        react(),
    ],
});
0 Answers
Related