forked from nathanstitt/dayz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
68 lines (59 loc) · 1.64 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
67
68
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var path = require('path');
var isProduction = process.env['NODE_ENV'] === 'production';
var config = {
cache: {},
devtool: isProduction ? undefined : 'source-map',
entry: (isProduction ? ['./style/dayz.scss','./src/dayz.jsx'] : ['./test/view.scss','./test/view.jsx']),
output: {
path: 'dist',
publicPath: isProduction ? '' : '/dist/',
filename: 'dayz.js',
libraryTarget: 'umd',
umdNamedDefine: true,
library: 'Dayz'
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: [/node_modules/], loader: 'babel-loader'
},
{ test: /\.scss$/, loader: ExtractTextPlugin.extract(
"style-loader", "css-loader!sass-loader")}
]
},
plugins: [
new ExtractTextPlugin("dayz.css")
],
resolve: {
root: path.resolve(__dirname, 'src'),
extensions: ['', '.js', '.jsx']
},
externals: {},
devServer: {
contentBase: './',
host: 'localhost',
inline: true,
outputPath: '/',
filename: '[name].js',
quiet: false,
noInfo: false,
hot: true,
stats: {
assets: false,
colors: true,
version: false,
hash: false,
timings: false,
chunks: false,
chunkModules: false
}
}
};
if (isProduction){
config.externals.react = 'React';
config.externals.moment = 'moment';
config.externals['moment-range'] = 'moment.range';
}
module.exports = config;