kenberkeley / vue-demo

Vue.js 示例项目 · 简易留言板。本项目拥有完善的文档说明与注释,让您快速上手 Vue.js 开发 SPA。Webpack / ES6 + Babel / Vue Router / (Vue Resource?) / (Vue Validator?) / (Vuex?) —— An Excellent Vue Starter with Best Practice / 最佳实践
https://kenberkeley.github.io/vue-demo/dist
Apache License 2.0
1.29k stars 410 forks source link

browser-sync-webpack-plugin 配置 #21

Closed luuman closed 7 years ago

luuman commented 7 years ago

修改

new BrowserSyncPlugin({
    host: 'localhost',
    port: PORTS.BROWSER_SYNC,
    proxy: 'localhost:' + PORTS.DEV_SERVER,
    notify: false
  }, {
    reload: false
  })

效果

luuman@luuman-PC MINGW64 /d/Vue/Github/vue-demo-master
$ npm start

> vue-demo@1.0.0 start D:\Vue\Github\vue-demo-master
> cross-env NODE_ENV=development node build/dev.js

[HPM] Proxy created: /  ->  http://127.0.0.1:9989
[HPM] Proxy rewrite rule created: "^/api" ~> "/"

▄    ▄▄▄▄    ▄▄▄▄    ▄▄▄▄    ▄▄▄▄    ▄▄▄▄    ▄▄▄▄  ,--------,      ,------.
▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░ │▗▝ ▞ ▝ ˄---˄  / Nyan! |
▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░~│ ▞  ▞ ❬.◕‿‿◕.❭--------’
▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░ `w-w---- w w
▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░
 (build time: 7.037s)
webpack built 1eac338fc25fd9ca2310 in 7041ms
[BS] Proxying: http://localhost:9000
[BS] Access URLs:
 -------------------------------------
       Local: http://localhost:9080
    External: http://172.16.21.48:9080
 -------------------------------------
          UI: http://localhost:3001
 UI External: http://172.16.21.48:3001
 -------------------------------------
[Logger] GET /auth/checkLogin
[Logger] GET /auth/checkLogin
[Logger] GET /auth/checkLogin

自动生成对应的IP地址:

luuman commented 7 years ago

未修改

$ npm start

> vue-demo@1.0.0 start D:\Vue\Github\vue-demo-master
> cross-env NODE_ENV=development node build/dev.js

[HPM] Proxy created: /  ->  http://127.0.0.1:8989
[HPM] Proxy rewrite rule created: "^/api" ~> "/"

▄▄▄    ▄▄▄▄    ▄▄▄▄    ▄▄▄▄    ▄▄▄▄    ▄▄▄▄    ▄▄▄
▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄ ,--------,      ,------.
▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄ │▗▝ ▞ ▝ ˄---˄  / Nyan! |
▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄~│ ▞  ▞ ❬.◕‿‿◕.❭--------’
▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄ `w-w---- w w
 (build time: 6.683s)
webpack built 1eac338fc25fd9ca2310 in 6687ms
[BS] Proxying: http://127.0.0.1:8000
[BS] Access URLs:
 ----------------------------------
       Local: http://localhost:8081
    External: http://127.0.0.1:8081
 ----------------------------------
          UI: http://localhost:3001
 UI External: http://127.0.0.1:3001
 ----------------------------------
[Logger] GET /auth/checkLogin
luuman commented 7 years ago

珍惜觉得你的项目配置的很好,期待想你请教!

kenberkeley commented 7 years ago

https://github.com/kenberkeley/vue-demo/commit/cf2cda73c5a676a3be3dff4b025500bec89b62af

Thanks a lot pal