/** * React Static Boilerplate * https://github.com/koistya/react-static-boilerplate * Copyright (c) Konstantin Tarkus (@koistya) | MIT license */ import browserSync from 'browser-sync'; import webpack from 'webpack'; import webpackDevMiddleware from 'webpack-dev-middleware'; import webpackHotMiddleware from 'webpack-hot-middleware'; global.watch = true; const config = require('./config')[0]; const bundler = webpack(config); browserSync({ server: { baseDir: 'build', middleware: [ webpackDevMiddleware(bundler, { // IMPORTANT: dev middleware can't access config, so we should // provide publicPath by ourselves publicPath: config.output.publicPath, // pretty colored output stats: config.stats, hot: true, historyApiFallback: true // for other settings see // http://webpack.github.io/docs/webpack-dev-middleware.html }), // bundler should be the same as above webpackHotMiddleware(bundler) ] }, // no need to watch '*.js' here, webpack will take care of it for us, // including full page reloads if HMR won't work files: [ 'build/**/*.css', 'build/**/*.html' ] });