lektor-webpack-support icon indicating copy to clipboard operation
lektor-webpack-support copied to clipboard

Webpack has been initialised using a configuration object that does not match the API schema.

Open 22Viig opened this issue 9 years ago • 2 comments

Following the readme guide and launching lektor with lektor server -f webpack it returns the following error:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.resolve has an unknown property 'modulesDirectories'. These properties are valid:
   object { alias?, aliasFields?, cachePredicate?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, symlinks?, unsafeCache?, useSyncFileSystemCalls? }
 - configuration.resolve.extensions[0] should not be empty.

22Viig avatar Feb 03 '17 13:02 22Viig

seems like readme example was wrote before webpack 2.x. So npm install --save-dev command install latest webpack version and webpack 2.x has a different api. You need to change:

resolve: {
  modulesDirectories: [...]
}

to something like this:

resolve: {
  modules: [...]
}

(maybe this solution leads to another problem) I think the best way is to fix the right version on npm install command.

StefanYohansson avatar Feb 08 '17 18:02 StefanYohansson

As @StefanYohansson mentioned already this is a web pack two issue and can be resolved for the time being with version pinning. See: https://github.com/lektor/lektor-webpack-support/issues/14

obestwalter avatar Feb 22 '17 20:02 obestwalter