启动 webpack-dev-server 时配置对象无效 [英] Invalid configuration object when starting webpack-dev-server

查看:97
本文介绍了启动 webpack-dev-server 时配置对象无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've just installed webpacker on my Rails 5.2 application and when trying to run bin/webpack-dev-server I get the following error:

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

key 应该在 configuration.entry 应该是以下之一:function |object 但不完全知道这是什么意思...

The key should be in configuration.entry should be one of these: function | object but don't exactly know what this means...

推荐答案

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

The issue was that when I installed webpacker (rails webpacker:install), I apparently already had an empty app/javascript folder so the installation skipped those installation files:

JavaScript 应用源目录已存在

The JavaScript app source directory already exists

手动添加 app/javascript/packs/application.js 文件修复了问题.

Manually adding the app/javascript/packs/application.js file fixed the issue.

这篇关于启动 webpack-dev-server 时配置对象无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆