-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.js
48 lines (47 loc) · 1.34 KB
/
webpack.dev.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
const path = require("path");
const webpack = require("webpack");
const ip = require("ip");
const webpackMerge = require("webpack-merge");
const OpenBrowserPlugin = require("open-browser-webpack-plugin");
const autoprefixer = require("autoprefixer");
const precss = require("precss");
const HTMLWebpackPlugin = require("html-webpack-plugin");
const baseConfig = require("./webpack.base.js");
const config = require("./config");
const port = config.port;
module.exports = function(env) {
const host = ip.address();
console.log(`Server is listening at: http://${host}:${config.port}`);
return webpackMerge(baseConfig(env), {
entry: [
"react-hot-loader/patch",
`webpack-dev-server/client?http://${host}:` + port,
path.resolve(__dirname, "../src/main.js")
],
devtool: "cheap-eval-source-map",
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.LoaderOptionsPlugin({
options: {
postcss() {
return [precss, autoprefixer];
}
}
}),
new HTMLWebpackPlugin({
title: "GIS",
minify: false,
template: "./src/index.html",
filename: "index.html",
favicon: "./favicon.ico",
version: ""
})
],
devServer: {
hot: true,
port: config.port,
host,
historyApiFallback: true
}
});
};