-
Notifications
You must be signed in to change notification settings - Fork 56
/
webpack.config.js
82 lines (80 loc) · 2.51 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
77
78
79
80
81
82
var webpack = require('webpack');
var path = require('path');
var ProgressBarPlugin = require('progress-bar-webpack-plugin');
var ForceCaseSensitivityPlugin = require('force-case-sensitivity-webpack-plugin');
var NODE_ENV = process.env.NODE_ENV
var publicPath = '/dist/';
module.exports = {
plugins: [
new ProgressBarPlugin(),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new ForceCaseSensitivityPlugin()
],
resolve: {
alias: {
"react": path.resolve('./node_modules/react'),
"react-router-dom": path.resolve('./node_modules/react-router-dom')
},
},
entry: {
app: NODE_ENV === 'dev' ?
[
"./demo/demo.js",
"webpack-hot-middleware/client?path=/__webpack_hmr&timeout=2000&overlay=false"
]
: './demo/demo.js',
},
output: {
path: path.join(__dirname, 'dist'),
filename: 'app.js',
publicPath: publicPath,
},
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
'less-loader',
{
loader: 'postcss-loader',
options: {
plugins: [require('autoprefixer')]
}
}
],
},
{
test: /\.less$/,
use: [
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
options: {
plugins: [require('autoprefixer')]
}
},
'less-loader',
],
},
{
test: /\.(png|jpg)$/,
use: 'url-loader?limit=8192&name=./image/[name].[ext]'
}, {
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: "babel-loader",
}, {
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
use: 'babel-loader',
}, {
test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
use: 'url-loader?limit=10000&name=./font/[name].[ext]'
}
],
}
};