【问题标题】:Invalid configuration object when starting webpack-dev-server启动 webpack-dev-server 时配置对象无效
【发布时间】:2019-05-16 14:32:27
【问题描述】:

我刚刚在我的 Rails 5.2 应用程序上安装了 webpacker,在尝试运行 bin/webpack-dev-server 时出现以下错误:

 ✖ 「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]

密钥应该在configuration.entry should be one of these: function | object,但不完全知道这是什么意思...

【问题讨论】:

    标签: ruby-on-rails webpack-dev-server ruby-on-rails-5.2 webpacker


    【解决方案1】:

    问题是当我安装 webpacker (rails webpacker:install) 时,我显然已经有一个空的 app/javascript 文件夹,所以安装跳过了那些安装文件:

    JavaScript 应用源目录已存在

    手动添加app/javascript/packs/application.js 文件解决了这个问题。

    【讨论】:

    • 我在将 rails 从 5.2 升级到 6.0 时遇到了同样的问题。这解决了我的情况。谢谢
    • 成功了!谢谢
    猜你喜欢
    • 2019-11-01
    • 1970-01-01
    • 2018-05-18
    • 2023-04-04
    • 2021-04-10
    • 2020-05-28
    • 2021-10-13
    • 2022-01-12
    • 2017-08-20
    相关资源
    最近更新 更多