Entry Descriptor Syntax Invalid Configuration

Viewed 435

So i'm trying to configure my webpack config to use the entry descriptor syntax as described here.

This is an example of my config:

    entry: {
      shared: [
        'react',
        'prop-types',
        'lodash',
        'moment',
        './src/utils/polyfills.js',
    ],
    index: { import: './src/index.js', dependOn: 'shared' },
  }

However, when I run my build I'm constantly seeing errors saying this syntax doesn't match their API.

Start Command: "dev": "webpack --watch --config webpack.client.js"

Error

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['index'] should be a string.
      -> The string is resolved to a module which is loaded upon startup.
    * configuration.entry['index'] should be an array:
      [non-empty string]
      -> A non-empty array of non-empty strings
    * configuration.entry['index'] should be one of these:
      [non-empty string]
      -> All modules are loaded upon startup. The last one is exported.
    * configuration.entry['index'] should be one of these:
      non-empty string | [non-empty string]
      -> An entry point with name

Has anyone seen this before? Any ideas?

1 Answers

Entry descriptors are a feature introduced in Webpack v5 which is currently in beta. This syntax is not available in Webpack v4. The webpack documentation seems to have switched to v5 already, documentation for v4 can be found here.

Related