-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
54 lines (53 loc) · 1.52 KB
/
webpack.config.js
File metadata and controls
54 lines (53 loc) · 1.52 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
module.exports = {
entry:"./app.js",//入口文件
output:{
path:__dirname,//输出的目录
filename: 'bundle.js'//输出的文件名称
},
devtool:"source-map",//便于调试,相当于命令行中 webpack --devtool source-map
module: {//依赖的模块
rules: [//模块、规则,如果在webpack旧版本中用的不是rules。用的是loaders
{
test: /\.js$/,
// exclude: /node_modules/,
loader: 'babel-loader',
query:{//es6预设
presets:["es2015","react"]
}
},
// {
// test: /\.js$/,
// exclude: /node_modules/,
// loader: 'babel-loader'
// },
// {
// test: /\.jsx$/,
// exclude: /node_modules/,
// loader: 'jsx-loader'
// },
{
test: /\.css$/,
exclude: /node_modules/,
loader: 'style-loader!css-loader'
},
{
test: /\.less$/,
exclude: /node_modules/,
loader: 'style-loader!css-loader!less-loader'
},
{
test: /\.scss$/,
exclude: /node_modules/,
loader: 'style-loader!css-loader!sass-loader'
},
{//背景图片
test:/\.(jpg|png|gif)$/,
loader:"url-loader?limit=1024"
},
{//字体文件
test:/\.(eot|woff|svg|ttf|woff2|gif|appcache)(\?|$)/,
loader:'file-loader?name=[name].[ext]'
}
]
}
}