Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

npm run dev stops with "laravel-vite-plugin: missing configuration"

Errorlaravel-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.

  • Applies to Laravel 12, laravel-vite-plugin 1.x, Vite 7, Node.js 22
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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.js
  2. 2Match what you see, then jump to its fix

    1. 1laravel-vite-plugin: missing configuration.laravel() is called without an argumentFix
    2. 2laravel-vite-plugin: missing configuration for "input".The options object has no input keyFix
    3. 3laravel-vite-plugin: publicDirectory must be a subdirectory. E.g. 'public'. (or the same for buildDirectory with 'build')publicDirectory or buildDirectory is emptyFix

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.js

2Fix

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 dev

Confirmed by raw.githubusercontent.com

Did this fix it?

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.js

2Fix

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 build

Confirmed by laravel.com

Did this fix it?

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.js

2Fix

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 build

Confirmed by raw.githubusercontent.com

Did this fix it?

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:

Related fixes

Web 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 fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.