【问题标题】:Attempting to change webpack-dev-server host尝试更改 webpack-dev-server 主机
【发布时间】:2018-03-25 19:49:24
【问题描述】:

尝试将 webpack-dev-server 中的主机从 0.0.0.0 更改为 localhost

我查看了代码(为 Rails 5.1.3 生成的bin/web-pack-dev-server),试图理解它,并注意到我认为是--host 参数

PORT=8080 bin/webpack-dev-server --host=localhost

--host=localhost 标志不起作用。

来自bin/web-pack-dev-server

begin
  dev_server = YAML.load_file(CONFIG_FILE)["development"]["dev_server"]

  DEV_SERVER_HOST = "http#{"s" if args('--https') ||     dev_server["https"]}://#{args('--host') || dev_server["host"]}:#{args('--port')     || dev_server["port"]}"
  puts DEV_SERVER_HOST
rescue Errno::ENOENT, NoMethodError
  puts "Webpack dev_server configuration not found in #{CONFIG_FILE}."
  puts "Please run bundle exec rails webpacker:install to install webpacker"
  exit!
end

【问题讨论】:

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


    【解决方案1】:

    PORT=8080 bin/webpack-dev-server --host=localhost 更改为PORT=8080 bin/webpack-dev-server --host localhost

    只需删除 = 即可修复它。

    【讨论】:

      猜你喜欢
      • 2017-09-07
      • 2016-06-15
      • 1970-01-01
      • 1970-01-01
      • 2018-10-25
      • 2017-08-07
      • 2016-02-01
      • 2022-06-23
      相关资源
      最近更新 更多