forked from ringteki/ringteki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
76 lines (73 loc) · 2.13 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
69
70
71
72
73
74
75
76
var webpack = require('webpack');
var path = require('path');
var precss = require('precss');
var autoprefixer = require('autoprefixer');
var BUILD_DIR = path.resolve(__dirname, 'public');
var APP_DIR = path.resolve(__dirname, 'client');
var LESS_DIR = path.resolve(__dirname, 'less');
var config = {
devtool: 'inline-source-map',
entry: [
'babel-polyfill',
'react-hot-loader/patch',
'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=2000',
'webpack/hot/only-dev-server',
path.join(__dirname, 'client/index.jsx'),
LESS_DIR + '/site.less'
],
output: {
path: BUILD_DIR,
filename: 'bundle.js',
publicPath: '/'
},
devServer: {
hot: true,
contentBase: BUILD_DIR,
publicPath: '/'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
'__DEV__': JSON.stringify('true')
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
})
],
module: {
loaders: [
{
test: /\.jsx?/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader'
},
{
test: /\.less$/,
use: [
'style-loader',
'css-loader',
'less-loader'
]
},
{
test: /\.json?/,
loader: 'json-loader'
},
{
test: /\.scss$/,
use: [
'style-loader',
'css-loader',
'sass-loader'
]
}, {
test: /.(png|woff(2)?|eot|ttf|svg)(\?[a-z0-9=\.]+)?$/,
loader: 'url-loader?limit=100000'
}]
}
};
module.exports = config;