forked from xiangsanmei/react-by
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
64 lines (61 loc) · 1.63 KB
/
webpack.config.js
File metadata and controls
64 lines (61 loc) · 1.63 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
var path = require('path');
var webpack = require('webpack');
var autoprefixer = require('autoprefixer');
var plugins = [];
// 路径直接这样写比较好
var outpath = './build'
// var outpath = path.resolve(__dirname, 'build');
module.exports = {
devtool: 'eval',
devServer: {
proxy: {
"/api/*": {
target: "https://cnodejs.org",
secure: false
}
},
contentBase: "./public",
colors: true,
historyApiFallback: true,
port:8888,
open:true,
inline: true,
},
entry: [
'./src/myapp/containers/app'
],
output: { //出口 编译后的文件
path: outpath,
publicPath: '/assets/',
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.scss$/,
// exclude: [nodeModulesPath]用来排除不处理的目录
exclude: path.resolve(__dirname, 'src/styles'),
loader: 'style!css?modules!postcss!sass'
},
{
test: /\.css$/,
include: path.resolve(__dirname, 'src/styles'),
loader: 'style!css'
},
{
test: /\.(gif|jpg|png|woff|svg|eot|ttf)\??.*$/,
loader: 'url?limit=50000&name=[path][name].[ext]'
}
]
},
resolve: {
extensions: ['', '.js', '.jsx']
},
plugins: plugins,
postcss: [autoprefixer]
};