Laravel-mix: Invalid configuration object

Created on 27 Dec 2016  路  10Comments  路  Source: JeffreyWay/laravel-mix

Using master, this:

mix.js('resources/assets/js/web.js', 'public/js')
   .js('resources/assets/js/app.js', 'public/js');

Results in:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.entry['app'] should be one of these:
   string | [string]
   The entry point for one output file.
 - configuration.entry should be one of these:
   object { <key>: string | [string] } | string | [string]
   The entry point(s) of the compilation.

Is there something I'm doing wrong? Totally new to Webpack.

Most helpful comment

run:npm uninstall laravel-mix && npm install --save laravel-mix

I had an issue where it wouldn't just update.

All 10 comments

mix.js('resources/assets/js/web.js', 'public/js/web.js')
   .js('resources/assets/js/app.js', 'public/js/app.js');

OR

mix.js([
  'resources/assets/js/web.js',
  'resources/assets/js/app.js'
], 'dist/bundle.js');

sauce: https://github.com/JeffreyWay/laravel-mix/issues/2#issuecomment-269259741

Actually all 3 fail for me.

mix.js('resources/assets/js/web.js', 'public/js')
   .js('resources/assets/js/app.js', 'public/js');

mix.js('resources/assets/js/web.js', 'public/js/web.js');
   .js('resources/assets/js/app.js', 'public/js/app.js');

mix.js('resources/assets/js/web.js', 'public/js/web.js');

@tillkruss - Have you updated your webpack.config.js file to the latest version? I'd bet that's the issue.

@JeffreyWay yes, that did the trick. Thanks a lot!

I'm getting following with fresh install.

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration.output.path: The provided value "public" is not an absolute path!

__Steps to reproduce__

  1. laravel new example
  2. yarn
  3. npm run watch

Laravel Installer 1.3.3 & npm 4.4.1

__Update__

Mix incompatible with Webpack 2.3.0 - issue #595

Solution is to update devDependencies in package.json file to require WebPack 2.2.1 version

"webpack": "2.2.1",

@alenabdula This was fixed last night. Update Mix.

@JeffreyWay thanks. Great work as always!

@JeffreyWay Thanks for the fix.

Just in case someone else is having trouble with this, the error message also comes in this flavour and is fixed by this update of laravel-mix.

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.output.filename: A relative path is expected. However the provided value "/js/[name].js" is an absolute path!
 - configuration.output.path: The provided value "public" is not an absolute path!

run:npm uninstall laravel-mix && npm install --save laravel-mix

I had an issue where it wouldn't just update.

@jasonspick Try installing with --save-dev flags as Laravel Mix is installed under devDependencies in your package.json

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mstralka picture mstralka  路  3Comments

Bomavi picture Bomavi  路  3Comments

pixieaka picture pixieaka  路  3Comments

jpriceonline picture jpriceonline  路  3Comments

stefensuhat picture stefensuhat  路  3Comments