-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
42 lines (39 loc) · 1.1 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
/**
* Created by wanglei on 2017/1/3.
*/
var path = require('path');
var config = {
entry: path.resolve(__dirname, './src/app.js'),
output: {
path: path.resolve(__dirname, './src/build'),
filename: 'bundle.js'
},
resolve: {
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [
{
test: /\.jsx?$/, // 用正则来匹配文件路径,这段意思是匹配 js 或者 jsx
loader: 'babel', // 加载模块 "babel" 是 "babel-loader" 的缩写
exclude: /node_modules/,
query: {
presets:['react','es2015','stage-0']
}
},
{
test: /\.css$/, // Only .css files
loader: 'style!css' // Run both loaders
},
{
test: /\.less$/,
loader: 'style!css!less'
},
{
test: /\.(png|jpg)$/,
loader: 'url-loader?limit=8192&name=image/[hash:8].[name].[ext]'
}
]
}
};
module.exports=config;