-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
88 lines (84 loc) · 2.2 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
83
84
85
86
87
88
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
const outputPath = path.resolve(__dirname,'build');
var plugins = [
// 使用 ProvidePlugin 加载使用率高的依赖库
new webpack.ProvidePlugin({
$: 'jquery',
jQuery:'jquery'
}),
//将样式统一发布到style.css中
new ExtractTextPlugin("style.css", {
allChunks: true,
disable: false
}),
new webpack.HotModuleReplacementPlugin()
];
module.exports = {
devServer: {
proxy:{
'/skilltree-app/*':{
target:'http://127.0.0.1:8080',
secure:false
}
},
historyApiFallback:true,
port:'3000',
hot: true,
inline: true
},
entry:['./src/main.jsx'],
output:{
path:outputPath,
publicPath:'/assets/',
filename:'bundle.js'
},
module:{
loaders:[
{
test:/\.jsx$/,
exclude:/node_modules/,
loaders:['react-hot', 'babel?presets[]=react,presets[]=es2015']
},
{
test:/\.js$/,
exclude:/node_modules/,
loader:'babel'
},
{
test: /\.styl$/,
loader: ExtractTextPlugin.extract(
"style", 'css!stylus')
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract(
"style", 'css!sass')
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract(
"style", 'css!less')
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract(
"style", 'css')
},
{
test: /\.(eot|svg|ttf|woff|woff2|png|jpg)\w*/,
loader: 'file'
},
{
test:/\.json$/,
loader:'json'
}
]
},
babel: {
presets: ['es2015','react','stage-0']
},
plugins:plugins,
devtool: 'source-map'
}