-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
65 lines (57 loc) · 1.53 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
const path = require('path');
const webpack = require('webpack');
const BundleTracker = require('webpack-bundle-tracker');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const PATHS = {
app: path.join(__dirname, 'assets', 'js'),
style: path.join(__dirname, 'assets', 'css'),
dist: path.join(__dirname, 'assets', 'bundles'),
};
module.exports = {
context: __dirname,
entry: [
'webpack-dev-server/client?http://0.0.0.0:3000',
'webpack/hot/only-dev-server',
path.resolve(PATHS.app, 'index.jsx'),
],
output: {
path: PATHS.dist,
filename: '[name]-[hash].js',
publicPath: 'http://0.0.0.0:3000/assets/bundles/',
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new BundleTracker({
filename: './webpack-stats.json',
}),
new ExtractTextPlugin('[name].css'),
],
module: {
loaders: [
{ test: /\.(jsx|js)$/,
include: PATHS.app,
loaders: ['react-hot', 'babel-loader'],
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract('css!less'),
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?limit=10000&minetype=application/font-woff',
},
{
test: /\.(ttf|eot|svg|jpg|png)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader',
},
],
},
resolve: {
modulesDirectories: ['node_modules', 'bower_components'],
extensions: ['', '.js', '.jsx'],
},
devServer: {
stats: 'errors-only',
},
};