Vue CLI 4+Vagrant HMR有効化
HMRを有効にする設定。
Vagranfile
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu1804"
config.vm.provision "shell", inline: <<-SHELL
apt-get -y update
echo "set grub-pc/install_devices /dev/sda" | debconf-communicate
apt-get -y dist-upgrade
apt-get -y autoremove
apt-get install -y nodejs npm
npm install n -g
n stable
cd /home/vagrant/app
npm install
npm rebuild node-sass
SHELL
config.vm.synced_folder "./", "/home/vagrant/app", SharedFoldersEnableSymlinksCreate: true
config.vm.network "forwarded_port", guest: 8080, host: 8080
end
プライベートIPにwebsocketをはろうとするので、ループバックアドレスに修正。
vue.config.js
module.exports = {
devServer: {
public: '127.0.0.1:8080',
}
}
Vagrantの共有フォルダではファイルの変更を検知できないため、vagrant-notify-forwarderConnectionプラグインを入れる。
$ vagrant plugin install vagrant-notify-forwarder
$ vagrant reload
Author And Source
この問題について(Vue CLI 4+Vagrant HMR有効化), 我々は、より多くの情報をここで見つけました https://qiita.com/toriumi01/items/61a60c62a0a3e39ddba0著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .