-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwebpack.config.js
41 lines (38 loc) · 1.13 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
var webpack = require('webpack');
var autoprefixer = require('autoprefixer');//自动修补css浏览器前缀
module.exports = {
devtool: 'eval-source-map',//生成source map以追踪js错误
entry: __dirname + "/index.js",//js入口
output: {
path: __dirname + "/server",//输出路径
filename: "bundle.js"//输出名
},
module:{
loaders:[
{
test:/\.js$/,//js loader
exclude:/node_modules/,
loader:'babel'//更多配置在.babelrc
},
{
test:/\.css$/,//css loader
loader:'style!css?!postcss'
// loader:'style!css?modules!postcss'//css模块化
},
]
},
devServer: {//webpack-dev-server 配置
contentBase: "./server",
colors: true,
historyApiFallback: true,
inline: true,
hot:true//热更新
},
postcss:[
autoprefixer({browsers:['last 10 versions']})//postcss 插件
],
plugins:[
new webpack.BannerPlugin('Copyright Chvin'),//添加 js头
new webpack.HotModuleReplacementPlugin()//热更新
]
}