서버/프론트 구분이 없는 환경일 경우 옛날에는 이렇게 세팅해서 개발. 이미 떠 있는 서버 앞에 프록시를 두고 정적 파일만 직접 감시.1

const bs = require('browser-sync').create()

bs.init({
  port: 8081,
  https: false,
  proxy: 'http://localhost:8080',
  serveStatic: [
    {
      route: '/resources',
      dir: 'src/main/webapp/resources',
    },
  ],
  files: 'src/main/webapp/resources/**/*',
  open: false,
})

Footnotes

  1. Browsersync options: proxy — “Proxy an EXISTING vhost. Browsersync will wrap your vhost with a proxy URL to view your site.” / serveStatic — “Add additional directories from which static files should be served.” / files — “Browsersync can watch your files as you work. Changes you make will either be injected into the page (CSS & images) or will cause all browsers to do a full-page refresh.” ↩

`#72`