webpack - various ameliorations
This commit is contained in:
24
watch.js
24
watch.js
@@ -1,25 +1,31 @@
|
||||
/* eslint no-console: 0 */
|
||||
|
||||
process.env.SCRIPT = 'watch';
|
||||
|
||||
// External dependencies
|
||||
var webpack = require('webpack'),
|
||||
webpackDevMiddleware = require('webpack-dev-middleware'),
|
||||
webpackHotMiddleware = require('webpack-hot-middleware'),
|
||||
browserSync = require('browser-sync');
|
||||
|
||||
var devBuildConfig = require('./webpack.config'),
|
||||
config = require('./config'),
|
||||
compiler = webpack(devBuildConfig);
|
||||
// Internal dependencies
|
||||
var webpackConfig = require('./webpack.config'),
|
||||
config = require('./assets/config');
|
||||
|
||||
// Internal variables
|
||||
var host = 'http://localhost',
|
||||
port = config.devPort || '3000',
|
||||
compiler;
|
||||
|
||||
webpackConfig.output.publicPath = host + ':' + port + config.output.publicPath;
|
||||
compiler = webpack(webpackConfig);
|
||||
|
||||
browserSync.init({
|
||||
port: port,
|
||||
proxy: {
|
||||
target: config.devUrl,
|
||||
middleware: [
|
||||
webpackDevMiddleware(compiler, {
|
||||
publicPath: devBuildConfig.output.publicPath,
|
||||
publicPath: webpackConfig.output.publicPath,
|
||||
stats: {
|
||||
colors: true
|
||||
},
|
||||
}
|
||||
}),
|
||||
webpackHotMiddleware(compiler, {
|
||||
log: browserSync.notify
|
||||
|
||||
Reference in New Issue
Block a user