forked from gpbl/isomorphic500
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.config.js
50 lines (41 loc) · 1.4 KB
/
dev.config.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
43
44
45
46
47
48
49
50
// This is the webpack config to use during development.
// It enables the hot module replacement, the source maps and inline CSS styles.
/* eslint no-var: 0, no-console: 0 */
import path from "path";
import webpack from "webpack";
import WebpackErrorNotificationPlugin from "webpack-error-notification";
const host = process.env.HOST || "0.0.0.0";
const port = (process.env.PORT + 1) || 3001;
const dist = path.resolve(__dirname, "../static/dist");
const config = {
devtool: "source-map",
entry: [
"webpack-dev-server/client?http://" + host + ":" + port,
"webpack/hot/only-dev-server",
"./src/client.js"
],
output: {
filename: "bundle.js",
chunkFilename: "[name].bundle.js",
path: dist,
publicPath: "http://" + host + ":" + port + "/dist/"
},
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loaders: ["react-hot", "babel?cacheDirectory"] },
{ test: /\.scss$/, loaders: ["style", "css", "autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap=true&sourceMapContents=true"] },
{ test: /\.(jpe?g|png|gif|svg)$/, loader: "file" }
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("development"),
BROWSER: JSON.stringify(true)
}
}),
new WebpackErrorNotificationPlugin()
]
};
export default config;