123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- /**
- * 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 hygienistMiddleware from 'hygienist-middleware';
- import webpackDevMiddleware from 'webpack-dev-middleware';
- import webpackHotMiddleware from 'webpack-hot-middleware';
- global.watch = true;
- const webpackConfig = require('./config')[0];
- const bundler = webpack(webpackConfig);
- export default async () => {
- await require('./build')();
- browserSync({
- server: {
- baseDir: 'build',
- middleware: [
- hygienistMiddleware('build'),
- webpackDevMiddleware(bundler, {
- // IMPORTANT: dev middleware can't access config, so we should
- // provide publicPath by ourselves
- publicPath: webpackConfig.output.publicPath,
- // pretty colored output
- stats: webpackConfig.stats,
- // 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',
- ],
- });
- };
|