-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
54 lines (52 loc) · 1.39 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
var webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const DEBUG = (process.argv.indexOf('--release') === -1);
module.exports = {
entry: {
app: ['babel-polyfill', 'isomorphic-fetch', './src/main.jsx']
},
output: {
path: path.resolve(__dirname, "build"),
filename: DEBUG ? '/js/bundle.js' : '/js/bundle.[hash].js'
},
resolve: {extensions: ['', '.js', '.jsx']},
module: {
loaders: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
},
{
test: /\.(scss|css)$/,
loader: ExtractTextPlugin.extract('css!sass')
},
{
test: /\.(eot|svg|png|ttf|woff|woff2)$/,
loader: "url-loader?limit=100000&name=images/[name].[ext]"
}
]
},
plugins: [
new ExtractTextPlugin(DEBUG ? '/css/style.css' : '/css/style.[hash].css'),
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify(DEBUG ? "development" : "production")
}
}),
new HtmlWebpackPlugin({
template: 'index.html',
hash: DEBUG ? false : true,
filename: 'index.html',
inject: 'body',
minify: {
collapseWhitespace: DEBUG ? false : true
}
})
]
};