Remove even more whitespace

This commit is contained in:
Andras Schmelczer 2022-09-26 23:26:53 +02:00
parent d46fb44ff7
commit 2e41fb3199
No known key found for this signature in database
GPG key ID: 0EA1BC97D0AB076E

View file

@ -105,17 +105,26 @@ module.exports = (env, argv) => ({
{ {
test: /\.ts$/, test: /\.ts$/,
use: [ use: [
'ts-loader', argv.mode === 'production'
? {
loader: 'string-replace-loader',
options: {
search: /(['">])\s+([<'"])/gs,
replace: '$1$2',
},
}
: null,
argv.mode === 'production' argv.mode === 'production'
? { ? {
// for removing whitespace (mainly from template strings) which are not part of comments // for removing whitespace (mainly from template strings) which are not part of comments
loader: 'string-replace-loader', loader: 'string-replace-loader',
options: { options: {
search: /(?<!\/\/[^\n]*)\s+/gs, search: /(?<!\/\/[^\n]*)(\\n|\s)+/gs,
replace: ' ', replace: ' ',
}, },
} }
: null, : null,
'ts-loader',
].filter(Boolean), ].filter(Boolean),
}, },
], ],