npm run dev stops with "laravel-vite-plugin: missing configuration"
laravel-vite-plugin: missing configuration.Short answer
The Laravel Vite plugin checks its options before Vite starts. It stops with missing configuration when laravel() gets no argument, with missing configuration for "input" when the options object has no entry points, and with a subdirectory message when publicDirectory or buildDirectory is empty. Pass the entry files and give both directories a name.
Fix it fast
1Find out which cause you have
Read the words after "laravel-vite-plugin:". They name the option that failed. Then open the laravel() call in vite.config.js and compare it with that option.
npm run dev grep -n -A8 "laravel(" vite.config.js2Match what you see, then jump to its fix
- 1
laravel-vite-plugin: missing configuration.laravel() is called without an argumentFix - 2
laravel-vite-plugin: missing configuration for "input".The options object has no input keyFix - 3
laravel-vite-plugin: publicDirectory must be a subdirectory. E.g. 'public'. (or the same for buildDirectory with 'build')publicDirectory or buildDirectory is emptyFix
- 1
What does the error look like?
laravel-vite-plugin: missing configuration.laravel-vite-plugin: missing configuration for "input".laravel-vite-plugin: publicDirectory must be a subdirectory. E.g. 'public'.laravel-vite-plugin: buildDirectory must be a subdirectory. E.g. 'build'.
Cause 1 of 3
laravel() is called without an argument
1Check
The plugin needs to be told where your entry points are. The call in vite.config.js is either empty, or it receives a variable whose value is undefined.
grep -n "laravel(" vite.config.js2Fix
Pass the entry files, either as an array or inside an options object. Laravel does not guess them.
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel([
'resources/css/app.css',
'resources/js/app.js',
]),
],
});3Verify
Start the dev server again. It must start and print a Local line instead of the plugin error.
npm run devConfirmed by raw.githubusercontent.com
Cause 2 of 3
The options object has no input key
1Check
You passed an object, for example to turn on refresh or to move the build folder, but the entry files are not inside it. With the object form the entry files go under input.
grep -n -A6 "laravel({" vite.config.js2Fix
Add input to the object and list the entry files in an array.
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),3Verify
Run the dev server, then run a build once, which reads the same options.
npm run dev
npm run buildConfirmed by laravel.com
Cause 3 of 3
publicDirectory or buildDirectory is empty
1Check
Both options are trimmed of spaces and slashes. A value that is empty after that, such as an empty string, a lone slash, or an environment variable that is not set, is rejected.
grep -n "publicDirectory\|buildDirectory" vite.config.js2Fix
Remove the option to get the default, or give it a real folder name. The Laravel docs show a custom build folder as buildDirectory: bundle; the Blade side has to be told the same folder, as in the second part of the example.
laravel({
input: ['resources/js/app.js'],
buildDirectory: 'bundle',
}),
{{-- Blade, only when you changed the build folder --}}
{{ Vite::useBuildDirectory('bundle')->withEntryPoints(['resources/js/app.js']) }}3Verify
Build the assets and load a page that uses @vite.
npm run buildConfirmed by raw.githubusercontent.com
How do I stop it coming back?
- Start from the vite.config.js that comes with a new Laravel project and add options to it, instead of writing the plugin call from memory.
- List the entry points yourself; the plugin does not look for them.
- When a directory name comes from an environment variable, give it a default so an empty string never reaches the plugin.
- After you change the build folder, request a page in the browser once to see that @vite finds the manifest.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- WorkforceA field app, an admin console and a self-hosted Node.js server for push and reconciliation.
- Spotless LaundryAn on-demand laundry app: Flutter on a Laravel back end, with Firebase for live updates.
Related fixes
Back end
npm run dev in Laravel cannot find vite.js
npm run dev exits right after starting, with a module error
The dev script runs the vite command from node_modules.
3 causes, each with a fixWeb apps
Vite cannot read your vite.config file
Cannot find module
Vite loads vite.config as a file in its own right, and it must be detected as ESM by Node.js if it uses import and export.
3 causes, each with a fixBack end
Laravel mix() fails with 'The Mix manifest does not exist'
The Mix manifest does not exist.
The mix() helper reads mix-manifest.json to find the hashed asset name, and that file only appears after Mix has compiled your assets.
2 causes, each with a fixBack end
Laravel mix() throws Unable to locate Mix file
Unable to locate Mix file: /css/app.css.
This error means mix-manifest.json exists but has no entry for the path you passed to mix().
4 causes, each with a fixBack end
npm run production fails in Laravel Mix with an unknown --hide-modules option
Unknown argument: --hide-modules
The scripts in your package.json were written for Mix 5, which called webpack directly with flags such as --hide-modules.
3 causes, each with a fixBack end
Laravel npm run dev says the mix command was not found
Command "mix" not found when running npm run dev
The mix program comes from the laravel-mix package.
3 causes, each with a fix