Skip to content

Commit 327a7ad

Browse files
authored
Use case-insensitive regex for all webpack assets (#26867)
Previously, only some of these regex had the `i` flag and while we can likely ensure case for our files, these regexes are also used for third-party files, so it's better to always match insensitively.
1 parent 4ab8e56 commit 327a7ad

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

webpack.config.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ const filterCssImport = (url, ...args) => {
4141

4242
if (cssFile.includes('fomantic')) {
4343
if (/brand-icons/.test(importedFile)) return false;
44-
if (/(eot|ttf|otf|woff|svg)$/.test(importedFile)) return false;
44+
if (/(eot|ttf|otf|woff|svg)$/i.test(importedFile)) return false;
4545
}
4646

47-
if (cssFile.includes('katex') && /(ttf|woff)$/.test(importedFile)) {
47+
if (cssFile.includes('katex') && /(ttf|woff)$/i.test(importedFile)) {
4848
return false;
4949
}
5050

@@ -117,12 +117,12 @@ export default {
117117
module: {
118118
rules: [
119119
{
120-
test: /\.vue$/,
120+
test: /\.vue$/i,
121121
exclude: /node_modules/,
122122
loader: 'vue-loader',
123123
},
124124
{
125-
test: /\.js$/,
125+
test: /\.js$/i,
126126
exclude: /node_modules/,
127127
use: [
128128
{
@@ -151,12 +151,12 @@ export default {
151151
],
152152
},
153153
{
154-
test: /\.svg$/,
154+
test: /\.svg$/i,
155155
include: fileURLToPath(new URL('public/assets/img/svg', import.meta.url)),
156156
type: 'asset/source',
157157
},
158158
{
159-
test: /\.(ttf|woff2?)$/,
159+
test: /\.(ttf|woff2?)$/i,
160160
type: 'asset/resource',
161161
generator: {
162162
filename: 'fonts/[name].[contenthash:8][ext]',

0 commit comments

Comments
 (0)