webpack.dev.config.js
1.15 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
'use strict';
const path = require('path');
const webpack = require('webpack');
const StyleLintPlugin = require('stylelint-webpack-plugin');
let baseConfig = require('./webpack.base.config.js');
baseConfig = baseConfig('dev');
baseConfig.devtool = '#inline-source-map';
baseConfig.output.publicPath = 'http://localhost:5001/';
baseConfig.module.rules.push({
enforce: 'pre',
test: /(\.js|\.vue)$/,
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
cache: true,
formatter: require('eslint/lib/formatters/codeframe')
}
});
baseConfig.devServer = {
host: '0.0.0.0',
port: 5001,
contentBase: [path.join(__dirname, './bundle/'), path.join(__dirname, '../')],
publicPath: baseConfig.output.publicPath,
hot: true,
inline: true,
compress: true,
stats: {
colors: true,
children: false
},
headers: {
'Access-Control-Allow-Origin': '*'
}
};
baseConfig.plugins.push(
new StyleLintPlugin({
files: ['public/scss/**/*.css', 'public/vue/**/*.vue'],
syntax: 'scss'
}),
new webpack.HotModuleReplacementPlugin()
);
module.exports = baseConfig;