【问题标题】:Entry Descriptor Syntax Invalid Configuration条目描述符语法无效配置
【发布时间】:2020-07-06 00:36:01
【问题描述】:

所以我正在尝试将我的 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

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

【问题讨论】:

    标签: node.js webpack webpack-4


    【解决方案1】:

    条目描述符是 Webpack v5 中引入的一项功能,目前位于 beta 中。此语法在 Webpack v4 中不可用。 webpack documentation 似乎已经切换到 v5,v4 的文档可以在 here 找到。

    【讨论】:

      猜你喜欢
      • 2020-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多