【问题标题】:Webpack Entry Descriptor Invalid Configuration SyntaxWebpack 条目描述符无效的配置语法
【发布时间】:2020-07-05 02:41:55
【问题描述】:

所以我正在尝试将我的 webpack 配置配置为使用 here 所述的条目描述符语法。

这是我的配置示例:

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

但是,当我运行构建时,我经常看到错误提示此语法与他们的 API 不匹配。

启动命令:“dev”:“webpack --watch --config webpack.client.js”

错误

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

有人见过这个吗?有什么想法吗?

【问题讨论】:

  • 你能解决这个问题吗?刚刚碰到了

标签: javascript node.js reactjs webpack webpack-4


【解决方案1】:

您使用的是哪个 webpack 版本?我认为 v5 上可用的条目描述符 https://github.com/webpack/webpack/releases/tag/v5.0.0-beta.14

【讨论】:

  • 不推荐仅链接答案。
猜你喜欢
  • 2020-07-06
  • 2019-12-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多