-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
66 lines (63 loc) · 1.45 KB
/
webpack.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const webpack = require("webpack");
const env = process.env.WEBPACK_ENV;
let config = {};
if(env === 'dev') {
config = require('./webpack.develop.config');
}
else {
config = require('./webpack.production.config');
}
let globalModule = {
preLoaders: [
{
test: /\.js$/, // include .js files
exclude: /node_modules/, // exclude any and all files in the node_modules folder
loader: "jshint-loader"
}
],
loaders: [
{
test: /\.css$/,
loader: "style!css"
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader'
}
]
};
if(config.module) {
if(config.module.loaders) {
config.module.loaders = config.module.loaders.concat(globalModule.loaders);
}
else {
config.module.loaders = globalModule.loaders;
}
if(config.module.preLoaders) {
config.module.preLoaders = config.module.preLoaders.concat(globalModule.preLoaders);
}
else {
config.module.preLoaders = globalModule.preLoaders;
}
}
else {
config.module = globalModule;
}
config.jshint = {
esversion: 6,
failOnHint: false,
loopfunc: true,
};
config.devServer = {
colors: true,
hot: true,
inline: true,
progress: true,
host: 'localhost',
port: 3000,
historyApiFallback: {
index: 'index.html'
}
};
module.exports = config;