I assume you mean with Vite?
If you want it to appear on all the same pages as app.js
then import it in app.js
import './my-new.js';
Otherwise, add your script to vite.config.js
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js', 'resources/js/my-new.js'],
refresh: true,
}),
],
});
Then import it on specific pages/layouts in the <HEAD>
section
@vite(['resources/css/app.css', 'resources/js/app.js', 'resources/js/my-new.js'])
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community