From b993c5f940b0cb69f34bff4c4b4cd6e546575ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Wed, 11 May 2022 15:53:46 +0900 Subject: [PATCH] perf(lib): reduce backtrack when injecting esbuild helpers (#8110) --- packages/vite/src/node/plugins/esbuild.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vite/src/node/plugins/esbuild.ts b/packages/vite/src/node/plugins/esbuild.ts index bc4a1f780a54d5..6fdf74ee05c4ad 100644 --- a/packages/vite/src/node/plugins/esbuild.ts +++ b/packages/vite/src/node/plugins/esbuild.ts @@ -27,9 +27,9 @@ import { searchForWorkspaceRoot } from '..' const debug = createDebugger('vite:esbuild') const INJECT_HELPERS_IIFE_RE = - /(.*)(var [^\s]+=function\(.*\){"use strict";)(.*)/ + /(.*)(var [^\s]+=function\([^)]*?\){"use strict";)(.*)/ const INJECT_HELPERS_UMD_RE = - /(.*)(\(function\(.*\){.+amd.+function\(.*\){"use strict";)(.*)/ + /(.*)(\(function\([^)]*?\){.+amd.+function\([^)]*?\){"use strict";)(.*)/ let server: ViteDevServer