forked from zendesk/linksf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.js
More file actions
51 lines (41 loc) · 1.36 KB
/
Copy pathstart.js
File metadata and controls
51 lines (41 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* 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('./webpack.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',
],
})
}