2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

vagrant,Rails5.2.1,webpack-dev-serverが動かせるようになった時のメモ

Posted at

環境

  • vagrant
  • ホスト Windows10
  • ゲスト Ubuntu 18.04.1 LTS
  • Rails5.2.1
  • turbolinks, sprockets, coffee無し
  • Ruby2.5.0

設定

config/webpacker.yml
  # webpacker.ymlより抜粋
  dev_server:
    https: false
    # locahostからvagrantのIPに変更する
    host: 192.168.33.10
    port: 3035
    # locahost:3035からvagrantのIP+portに変更する
    public: 192.168.33.10:3035
    hmr: false
    inline: true
    overlay: true
    compress: true
    disable_host_check: true
    use_local_ip: false
    quiet: false
    headers:
      'Access-Control-Allow-Origin': '*'
    watch_options: {
      ignored: /node_modules/,
      # ここを追加
      poll: true,
    }

あとは通常通り起動する

bash
bin/webpack-dev-server
rails s

最後に

ホストと仮想環境とのIPアドレスの仕組みが謎すぎるので
勉強する。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?