From 1bad91c018fba606e453f95bb044192bba71e3e0 Mon Sep 17 00:00:00 2001 From: Adam Skoufis Date: Tue, 13 Aug 2024 16:36:07 +1000 Subject: [PATCH] Replace overkill regex with a much simpler one --- src/content/plugins/normal-module-replacement-plugin.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/content/plugins/normal-module-replacement-plugin.mdx b/src/content/plugins/normal-module-replacement-plugin.mdx index 8f2508c6c0c3..c6089cdbe6de 100644 --- a/src/content/plugins/normal-module-replacement-plugin.mdx +++ b/src/content/plugins/normal-module-replacement-plugin.mdx @@ -5,6 +5,7 @@ contributors: - gonzoyumo - byzyk - chenxsan + - askoufis --- The `NormalModuleReplacementPlugin` allows you to replace resources that match `resourceRegExp` with `newResource`. If `newResource` is relative, it is resolved relative to the previous resource. If `newResource` is a function, it is expected to overwrite the request attribute of the supplied resource. @@ -46,7 +47,7 @@ module.exports = function (env) { return { plugins: [ new webpack.NormalModuleReplacementPlugin( - /(.*)-APP_TARGET(\.*)/, + /-APP_TARGET$/, function (resource) { resource.request = resource.request.replace( /-APP_TARGET/,