-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathwebpack.config.dev.js
106 lines (97 loc) · 2.55 KB
/
webpack.config.dev.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
const path = require('path');
const autoprefixer = require('autoprefixer');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
module.exports = {
context: path.join(__dirname, './src'),
entry: {
app: [
'webpack-hot-middleware/client?reload=true',
'./index.js',
],
vendors: [
'antd',
'classnames',
'jwt-decode',
'lodash',
'query-string',
'react',
'react-addons-transition-group',
'react-dom',
'react-redux',
'react-router',
'react-router-redux',
'react-router-scroll',
'recharts',
'redux',
'redux-actions',
'redux-thunk',
'reselect',
'whatwg-fetch',
],
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].[hash].min.js',
publicPath: '/',
sourceMapFilename: '[name].[hash].js.map',
chunkFilename: '[id].[hash].min.js',
},
devtool: 'cheap-module-eval-source-map',
plugins: [
new ProgressBarPlugin(),
new HtmlWebpackPlugin({
template: './index.html',
inject: 'body',
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.optimize.CommonsChunkPlugin('vendors', '[name].[hash].min.js'),
new webpack.optimize.OccurrenceOrderPlugin(true),
new ExtractTextPlugin('[name].css'),
new webpack.DefinePlugin({
'process.env': { NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development') },
}),
],
module: {
loaders: [
{
test: /\.css$/,
include: path.join(__dirname, 'src'),
loader: ExtractTextPlugin.extract('style-loader', '!css-loader!postcss-loader'),
},
{
test: /\.css$/,
exclude: path.join(__dirname, 'src'),
loader: 'style!css',
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!postcss-loader!less-loader'),
},
{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: ['babel'],
},
{
test: /\.json$/,
loader: 'json-loader',
},
{
test: /\.(png|jpg|jpeg|gif|svg)$/,
loader: 'url-loader?prefix=img/&limit=10000',
},
{
test: /\.(woff|woff2|ttf|eot)$/,
loader: 'url-loader?prefix=font/&limit=10000',
},
],
},
postcss: [autoprefixer],
resolve: {
extensions: ['', '.js', '.jsx'],
},
};