-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.client-watch.js
42 lines (34 loc) · 1.27 KB
/
webpack.client-watch.js
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
var webpack = require("webpack");
var config = require("./webpack.client.js");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var hostname = process.env.HOSTNAME || "localhost";
config.cache = true;
config.debug = true;
config.devtool = "eval-sourcemap";
config.entry.unshift(
"webpack-dev-server/client?http://" + hostname + ":8080",
"webpack/hot/only-dev-server"
);
config.output.publicPath = "http://" + hostname + ":8080/dist/";
config.output.hotUpdateMainFilename = "update/[hash]/update.json";
config.output.hotUpdateChunkFilename = "update/[hash]/[id].update.js";
config.plugins = [
new webpack.DefinePlugin({isBrowser: true}),
new webpack.HotModuleReplacementPlugin(),
new ExtractTextPlugin("style.css")
];
config.module.preLoaders.push({test: /\.jsx?$/, loaders: ['eslint-loader']});
config.module.postLoaders.push({test: /\.js$/, loaders: ["react-hot"], exclude: /node_modules/});
config.devServer = {
publicPath: "http://" + hostname + ":8080/dist/",
contentBase: "./static",
hot: true,
inline: true,
lazy: false,
quiet: true,
noInfo: false,
headers: {"Access-Control-Allow-Origin": "*"},
stats: {colors: true},
host: hostname
};
module.exports = config;