-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.hmr.config.js
43 lines (38 loc) · 1.4 KB
/
webpack.hmr.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
const StyleLintPlugin = require('stylelint-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const merge = require('webpack-merge');
require('dotenv').config();
const settings = require('./getSettings')();
const runDirectory = path.resolve(__dirname, '../../../');
const partialConfig = require('./webpack.partial.config.js')(runDirectory, settings);
/* lintDirtyModules is not working at the moment
* https://github.com/webpack-contrib/stylelint-webpack-plugin/pull/157
*/
module.exports = (env, argv) => {
const autoFix = typeof argv.fix !== 'undefined';
const resultingWebpackConfig = merge({
context: runDirectory,
entry: settings.entry,
devtool: 'source-map',
resolve: partialConfig.resolve,
output: partialConfig.output(`${process.env.NODE_DOMAIN}/`),
performance: partialConfig.performance,
devServer: partialConfig.devServer,
module: {
rules: [
partialConfig.rules.vue,
partialConfig.rules.vueStyleLoader,
partialConfig.rules.styleLoader,
partialConfig.rules.ts(autoFix),
],
},
plugins: [
new StyleLintPlugin(partialConfig.plugins.stylelint(autoFix, 'serve')),
new VueLoaderPlugin(),
new webpack.DefinePlugin(settings.definePlugin || {}),
],
}, settings.webpackConfig || {});
return resultingWebpackConfig;
};