-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
49 lines (48 loc) · 986 Bytes
/
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
//提出css到单独的css文件模块
var extractTextPlugin = require("extract-text-webpack-plugin");
//自动生成主页面的模块
var htmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
plugins:[
new htmlWebpackPlugin({
template:"./index.html"
}),
new extractTextPlugin("[hash]-bundle.css")
],
entry:{
main:"./main.js"
},
output:{
path:"./build",
filename:"[hash]-bundle.js"
},
module:{
loaders:[
{
test:/.css$/,
loader:extractTextPlugin.extract("css")
},
{
test:/.html/,
loader:"html"
},
{
test:/.(png|gif|jpg)/,
loader:"file-loader?name=images/[name].[ext]"
},
{
test:/.(eot|woff|ttf|svg)/,
loader:"file-loader?name=iconfont/[name].[ext]"
}
]
},
resolve:{
extensions:["",".js"],
alias:{
animationCss:"./src/css/animate.min.css",
swiperCss:"./src/css/swiper.min.css",
// animationJs:"./src/js/swiper.animate.min.js",
swiperJs:"./src/js/swiper.min.js"
}
}
}