-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
46 lines (40 loc) · 1.47 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
'use strict';
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const StyleLintPlugin = require('stylelint-webpack-plugin');
const webpack = require('webpack');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const merge = require('webpack-merge');
const settings = require('./getSettings')();
const runDirectory = path.resolve(__dirname, '../../../');
const partialConfig = require('./webpack.partial.config.js')(runDirectory, settings);
module.exports = (env, argv) => {
const autoFix = typeof argv.fix !== 'undefined';
require('./setNodeActiveEnvVar')(settings, false);
const resultingWebpackConfig = merge({
context: runDirectory,
entry: settings.entry,
devtool: 'source-map',
resolve: partialConfig.resolve,
output: partialConfig.output('/' + settings.directory.publicPath),
performance: partialConfig.performance,
module: {
rules: [
partialConfig.rules.vue,
partialConfig.rules.vueStyleLoader,
partialConfig.rules.miniCssExtract,
partialConfig.rules.ts(autoFix),
],
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css?bust=[contenthash]',
chunkFilename: '[id].css',
}),
new StyleLintPlugin(partialConfig.plugins.stylelint(autoFix, 'build')),
new VueLoaderPlugin(),
new webpack.DefinePlugin(settings.definePlugin || {}),
],
}, settings.webpackConfig || {});
return resultingWebpackConfig;
};