Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid configuration object when starting webpack-dev-server

I've just installed webpacker on my Rails 5.2 application and when trying to run bin/webpack-dev-server I get the following error:

 ✖ 「wds」: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.entry should be one of these:
   function | object { <key>: non-empty string | [non-empty string] } | non-empty string | [non-empty string]
   -> The entry point(s) of the compilation.
   Details:
    * configuration.entry should be an instance of function
      -> A Function returning an entry object, an entry string, an entry array or a promise to these things.
    * configuration.entry should not be empty.
      -> Multiple entry bundles are created. The key is the chunk name. The value can be a string or an array.
    * configuration.entry should be a string.
      -> An entry point without name. The string is resolved to a module which is loaded upon startup.
    * configuration.entry should be an array:
      [non-empty string]

The key should be in configuration.entry should be one of these: function | object but don't exactly know what this means...

like image 574
mrstif Avatar asked Dec 07 '22 12:12

mrstif


1 Answers

The issue was that when I installed webpacker (rails webpacker:install), I apparently already had an empty app/javascript folder so the installation skipped those installation files:

The JavaScript app source directory already exists

Manually adding the app/javascript/packs/application.js file fixed the issue.

like image 155
mrstif Avatar answered Jan 10 '23 01:01

mrstif