webpack.dev.config.js
1.3 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
'use strict';
const path = require('path');
const _ = require('lodash');
const webpack = require('webpack');
const devInfo = require('./dev-info.js');
let baseConfig = require('./webpack.base.config.js');
baseConfig = baseConfig('dev');
_.mergeWith(baseConfig, {
devtool: '#inline-source-map',
output: {
publicPath: devInfo.publicPath
},
module: {
rules: [{
enforce: 'pre',
test: /(\.js|\.vue)$/,
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
cache: true,
formatter: require('eslint/lib/formatters/codeframe')
}
}]
},
devServer: {
host: devInfo.host,
port: devInfo.port,
publicPath: devInfo.publicPath,
contentBase: [path.join(__dirname, '../public/bundle/'), path.join(__dirname, '../public')],
compress: true,
stats: {
colors: true,
children: false,
chunks: false,
assetsSort: 'size',
},
headers: {
'Access-Control-Allow-Origin': '*'
}
}
}, function customizer(objValue, srcValue) {
if (_.isArray(objValue)) {
return objValue.concat(srcValue);
}
});
delete baseConfig.extends;
module.exports = baseConfig;