-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathwebpack.server.config.js
More file actions
74 lines (68 loc) · 2.3 KB
/
webpack.server.config.js
File metadata and controls
74 lines (68 loc) · 2.3 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
var webpack = require('webpack');
var path = require('path');
//var config = require('./config.json');
var webpackDefaultConfig=require("./webpack.config");
var chunkConfig=require("./readModuleConfig");
var ip=require("./util").getIPAddress();
var webpackConfig = {
/**
* Server Configuration options
* doc: http://webpack.github.io/docs/webpack-dev-server.html
*/
devServer:{
contentBase:__dirname ,//path.join(__dirname, chunkConfig.distFile), //Relative directory for base of server
hot: true, //Live-reload
host:ip|| "127.0.0.1",
inline: true,
port:30001, //Port Number
// historyApiFallback: true,
stats: {
colors: true,
cached: false,
exclude: [/node_modules[\\\/]/]
}
},
/**
* Devtool
* doc: http://webpack.github.io/docs/configuration.html#devtool
*/
devtool: 'source-map',
/**
* switch loader to debug mode
* doc: http://webpack.github.io/docs/configuration.html#devtool
*/
debug: true,
module:{
loaders: [
{
test: /\.(png|jpg|svg|gif)$/,
loader: 'url?limit=20480&name=../../images/[name].[ext]'//20k
},
{
test: /\.(ttf|eot|svg|woff[1-9]?)$/,
loader: "file?name=../../fonts/[name].[ext]"
},
{
test: /\.jpeg?$/,
loader: 'file?name=../../images/[name]-[hash:8].[ext]'//20k
}
]
},
/**
* Plugin
* doc: http://webpack.github.io/docs/using-plugins.html
* list: http://webpack.github.io/docs/list-of-plugins.html
*/
plugins: [
//Enables Hot Modules Replacement
new webpack.HotModuleReplacementPlugin(),
//Allows error warnings but does not stop compiling. Will remove when eslint is added
new webpack.NoErrorsPlugin()
]
};
webpackDefaultConfig.devServer=webpackConfig.devServer;
webpackDefaultConfig.devtool=webpackConfig.devtool;
webpackDefaultConfig.module.loaders=webpackConfig.module.loaders.concat(webpackDefaultConfig.module.loaders);
webpackDefaultConfig.plugins=webpackDefaultConfig.plugins.concat(webpackConfig.plugins);
webpackDefaultConfig.debug=true;
module.exports = webpackDefaultConfig;