Hello everyone!
I am new to Laravel, so please be kind :)
I created a new project with the Breeze starter kit. I'm having trouble loading some of my assets.
In my head, I have this:
@vite(['resources/css/app.css', 'resources/js/app.js'])
At the bottom of the body, I want to load Preline, so I placed this:
<script src="{{ Vite::asset('node_modules/preline/dist/preline.js') }}"></script>
In my vite.config.js, I have this :
import { defineConfig } from "vite";
import laravel from "laravel-vite-plugin";
export default defineConfig({
plugins: [
laravel({
input: [
"resources/css/app.css",
"resources/js/app.js",
"node_modules/preline/dist/preline.js",
],
refresh: true,
}),
],
});
When running npm run dev, it works, but with npm run build, I get an error: "Unable to locate file in Vite manifest: node_modules/preline/dist/preline.js.".
The Preline JS is correctly generated in my public folder and in the JSON manifest I have this :
"node_modules/preline/dist/preline.js?commonjs-entry": {
"file": "assets/preline-gR2quG6j.js",
"name": "preline",
"src": "node_modules/preline/dist/preline.js?commonjs-entry",
"isEntry": true
}
A helping hand would be welcome.