-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
57 lines (51 loc) · 1.59 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
const ExtractTextPlugin = require('extract-text-webpack-plugin'); // css单独打包
module.exports = {
devtool: 'eval-source-map',
entry: __dirname + '/src/entry.js', //唯一入口文件
output: {
path: __dirname + '/build', //打包后的文件存放的地方
filename: 'bundle.js', //打包后输出文件的文件名
},
resolve: {
extensions: ['', '.js', '.jsx'],
},
eslint: {
failOnError: false,
failOnWarn: false,
},
module: {
preLoaders: [{
test: /\.js[x]$/,
loader: 'eslint-loader',
exclude: /node_modules/,
},],
loaders: [{
test: /\.js[x]?$/,
loader: 'babel-loader?presets[]=react,presets[]=es2015',
include: /src/,
exclude: /node_modules/,
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css!postcss'),
}, {
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style', 'css!postcss!sass'),
}, {
test: /\.(png|jpg)$/,
loader: 'url?limit=8192',
},],
},
postcss: [
require('autoprefixer'), //调用autoprefixer插件,css3自动补全
],
devServer: {
// contentBase: './src/views' //本地服务器所加载的页面所在的目录
port: 8080,
colors: true, //终端中输出结果为彩色
historyApiFallback: true, //不跳转
inline: true, //实时刷新
},
plugins: [
new ExtractTextPlugin('main.css'),
],
};