-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
executable file
·59 lines (56 loc) · 1.69 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
var path = require('path');
var webpack = require('webpack');
var autoprefixer = require('autoprefixer');
var DEBUG = process.env.NODE_ENV !== 'production' ? true : false;
var localAssetPath = 'commons/';
var config = {
context: __dirname + '/src',
devtool: 'source-map',
entry: ['./index.jsx', './index.html'],
output: {
filename: 'app.js',
path: __dirname + '/public'
},
plugins: [
new webpack.DefinePlugin({
DEBUG: JSON.stringify(DEBUG),
ASSET_PATH: JSON.stringify(localAssetPath)
})
],
resolve: {
root: [path.resolve('./src'), path.resolve(__dirname, 'node_modules')],
extensions: ['', '.js', '.jsx', '.css', '.scss']
},
module: {
loaders: [
{
test: /\.(jsx|js)/,
exclude: /node_modules/,
loaders: ['react-hot', 'babel-loader']
},
{
test: /\.html$/,
exclude: /node_modules/,
loader: 'file?name=[name].[ext]'
},
{ test: /\.json$/, loader: 'json-loader' },
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'url?limit=1000&name=images/[name]-[hash:5].[ext]',
'image-webpack-loader?bypassOnDebug&optimizationLevel=7&interlaced=false'
]
},
{ test: /\.woff$/, loader: 'url?limit=65000&mimetype=application/font-woff&name=fonts/[name].[ext]' },
{ test: /\.ttf$/, loader: 'url?limit=65000&mimetype=application/x-font-ttf&name=fonts/[name].[ext]' },
{ test: /\.eot$/, loader: 'url?limit=65000&mimetype=application/vnd.ms-fontobject&name=fonts/[name].[ext]' }
]
},
sassLoader: {
data: '$assetPath: "'+ localAssetPath +'";'
},
postcss: function () {
return [autoprefixer];
}
};
module.exports = config;