ruby-on-rails - rails webpack-dev-server "Invalid configuration object"

标签 ruby-on-rails webpack webpack-dev-server

当我尝试运行 ./bin/webpack-dev-server 我得到这个:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration has an unknown property 'mode'. These properties are valid:
   object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, module?, name?, node?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
   For typos: please correct them.
   For loader options: webpack 2 no longer allows custom properties in configuration.
     Loaders should be updated to allow passing options via loader options in module.rules.
     Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
     plugins: [
       new webpack.LoaderOptionsPlugin({
         // test: /\.xxx$/, // may apply this only for some modules
         options: {
           mode: ...
         }
       })
     ]

我很确定这是与包版本混淆的 yarn 。是否有我可以运行的“重新安装所有内容”命令?

我的版本是

webpack-dev-server@3.4.1

@rails/webpacker@3.5.5

最佳答案

很可能是 webpacker.yml 的问题。
就我而言 source_path不正确。

看到这个:Invalid configuration object when starting webpack-dev-server

关于ruby-on-rails - rails webpack-dev-server "Invalid configuration object",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56656581/

相关文章:

node.js - 为什么 'npm run build' 在开发服务器上花费 >30 分钟而在本地花费不到一分钟?

Npm 编译器 : Cannot read property 'startsWith' of undefined

mysql - rails 4 : how to use UNIX_TIMESTAMP with group YEAR

ruby-on-rails - Ruby on Rails ActiveRecord::PendingMigrationError

css - CRA + Craco + 多个 CSS 主题

javascript - 如何让源映射在 Webpack 中工作?

angularjs - 如何将.env文件变量传递给webpack配置?

ruby-on-rails - Rails 的动态菜单(在一个 View 中引用两个 Controller 的输出)

javascript - Ruby on Rails : At what point do you write raw javascript instead of using rjs templates?

javascript - Laravel Mix 中的 Webpack 别名为 node_modules