Repository navigation
Expand file tree
/
Copy pathwebpack.config.js
More file actions
69 lines (67 loc) · 1.82 KB
/
Copy pathwebpack.config.js
File metadata and controls
69 lines (67 loc) · 1.82 KB
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
var path = require('path');
var webpack = require('webpack');
var HtmlwebpackPlugin = require('html-webpack-plugin');
var ROOT_PATH = path.resolve(__dirname);
var APP_PATH = path.resolve(ROOT_PATH, 'app');
var BUILD_PATH = path.resolve(ROOT_PATH, 'build');
module.exports = {
entry: {
app: path.resolve(APP_PATH, './view/app.jsx')
},
output: {
path: BUILD_PATH,
filename: '[name].js'
},
//enable dev source map
devtool: 'eval-source-map',
devServer: {
proxy: {
'/jgb-web/v1': {
// target: 'http://10.10.10.204:9096',
target: 'http://www.51jigoubao.com',
host: "www.51jigoubao.com",
origin: "http://www.51jigoubao.com",
secure: false
}
}
},
// devServer: {
// historyApiFallback: true,
// hot: true,
// inline: true,
// stats: { colors: true },
// proxy: {
// '/jgb-web': {
// target: 'http://10.10.10.204',
// pathRewrite: {'^/v1' : '/v1'},
// changeOrigin: true
// }
// }
// },
resolve: {
extensions: ['', '.js', '.jsx']
},
//babel重要的loader在这里
module: {
loaders: [{
test: /\.jsx?$/,
loader: 'babel',
include: APP_PATH,
query: {
//添加两个presents 使用这两种presets处理js或者jsx文件
presets: ['es2015', 'react']
}
}, {
test: /\.scss$/,
loaders: ['style', 'css', 'sass']
}, {
test: /\.(png|jpg)$/,
loader: 'url?limit=40000'
}]
},
plugins: [
new HtmlwebpackPlugin({
template: 'app/index.html'
})
]
}