-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
91 lines (88 loc) · 2.4 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
const glob = require('glob');
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const RemoveEmptyScripts = require('webpack-remove-empty-scripts');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const GlobImporter = require('node-sass-glob-importer');
module.exports = {
watchOptions: {
poll: true,
ignored: '**/node_modules',
},
devtool: 'source-map',
entry: () => {
const friendsClient = glob
.sync('./src/friends-client/customisable/**/*.+(scss|css)')
.reduce(
(acc, file) => {
acc[
file
.replace(/src\/friends-client\/customisable/, 'friends-client')
.replace(/\.(scss|css)/gi, '')
] = file;
return acc;
},
{
'friends-client/friends-client':
'./src/friends-client/friendsChat.dev.scss',
}
);
const steamClient = glob
.sync('./src/steam-client/customisable/**/*.+(scss|css)')
.reduce(
(acc, file) => {
acc[
file
.replace(/src\/steam-client\/customisable/, 'steam-client')
.replace(/\.(scss|css)/gi, '')
] = file;
return acc;
},
{
'steam-client/steam-client':
'./src/steam-client/steam-client.dev.scss',
}
);
return { ...friendsClient, ...steamClient };
},
resolve: {
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
preferRelative: true,
},
module: {
rules: [
{
test: /\.s?[ac]ss$/i,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'postcss-loader',
options: {
postcssOptions: { plugins: ['postcss-preset-env'] },
},
},
{
loader: 'sass-loader',
options: {
sassOptions: {
importer: GlobImporter(),
includePaths: [path.resolve(__dirname, 'src')],
},
additionalData: `$VERSION: ${process.env.npm_package_version};`,
},
},
],
},
{
test: /\.(png|jpg|gif|svg)$/i,
type: 'asset/inline',
},
],
},
optimization: {
minimize: false,
minimizer: [new CssMinimizerPlugin()],
},
plugins: [new RemoveEmptyScripts(), new MiniCssExtractPlugin()],
};