-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
59 lines (55 loc) · 1.55 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var HtmlWebpackPlugin = require("html-webpack-plugin")
var ExtractWebpackPlugin = require("extract-text-webpack-plugin")
module.exports = {
entry:'./src/app.js',//人口文件,
output:{
path:__dirname+'/build',
filename:'app.js'
},
devServer:{
contentBase:'./build',//服务器要在哪个地方开启,默认是在webpack.config.js的路径中
port:9000,//端口
host:'localhost',//域名
historyApiFallback:true//是否使用history的go方法
},
plugins:[
new HtmlWebpackPlugin({
template:'./src/index.html',
filename:'index.html'
}),
new ExtractWebpackPlugin({
filename:'app.css',
allChunks:true
})
],
module:{
loaders:[
// {
// test:/\.css$/,
// loader:'style-loader!css-loader'
// },
// {
// test:/\.scss$/,
// loader:'style-loader!css-loader!sass-loader'
// },
{
test:/\.css$/,
loader:ExtractWebpackPlugin.extract({
fallback:'style-loader',
use:'css-loader'
})
},
{
test:/\.scss$/,
loader:ExtractWebpackPlugin.extract({
fallback:'style-loader',
use:'css-loader!sass-loader'
})
},
{
test:/\.js$/,
loader:'jsx-loader'
}
]
}
}