I tried with fresh install laravel 9.20 and with minimum configuration
in vite.config.js
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
input: [
'resources/js/app.js',
],
refresh: true,
}),
],
});
in app.js
import './bootstrap';
import $ from "jquery";
window.$ = window.jQuery = $;
import '../sass/app.scss';
i have tried with this too
import * as $ from "jquery";
window.$ = window.jQuery = $;
load the assets in blade and i test with this script
@vite(['resources/js/app.js']);
$("#alertbox").alert("test");
but i get the following error in the console:
Uncaught ReferenceError: $ is not defined
I can't make it work, please help