forked from tkiethanom/descent2e-dice
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
63 lines (58 loc) · 1.81 KB
/
webpack.config.js
File metadata and controls
63 lines (58 loc) · 1.81 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
var IS_DEV = (process.env.NODE_ENV == 'development') ? true : false;
var webpack = require('webpack');
if(IS_DEV){
var WebpackNotifierPlugin = require('webpack-notifier');
}
module.exports = {
entry: (IS_DEV) ? [
'webpack-dev-server/client?http://localhost:8080', // WebpackDevServer host and port
'webpack/hot/only-dev-server', // "only" prevents reload on syntax errors
"./src/main.js"
] : ["./src/main.js"],
output: {
path: __dirname,
filename: "js/app.js",
publicPath: '/'
},
devtool: (IS_DEV) ? "source-map" : '',
module: {
loaders: [
{ test: /\.css$/, loaders: ["style", "css", "resolve-url"] },
{ test: /\.scss$/,
loaders: (IS_DEV)
? ["style", "css", "resolve-url", "sass?sourceMap"]
: ["style", "css", "resolve-url", "sass"]
},
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&mimetype=application/font-woff" },
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000" },
{ test: /\.(js|jsx)$/,
exclude: /(node_modules)/,
loaders: (IS_DEV) ? ['react-hot', 'babel'] : ['babel']
},
{ test: /\.(json)$/,
exclude: /(node_modules)/,
loaders: ['json']
}
]
},
resolve: {
alias: {
'data': __dirname + '/src/data',
'sass': __dirname + '/src/sass',
'components': __dirname + '/src/components',
'reducers': __dirname + '/src/reducers',
'actions': __dirname + '/src/actions',
'pages': __dirname + '/src/pages',
'helpers': __dirname + '/src/helpers'
}
},
plugins: (IS_DEV) ? [
new WebpackNotifierPlugin({alwaysNotify: true}),
new webpack.HotModuleReplacementPlugin()
] : [],
devServer: {
hot: true,
historyApiFallback: true,
publicPath: '/'
}
};