fix(ct): update regex to cater for minified JS files (#22017)

This commit is contained in:
Nathan Power 2023-03-28 19:15:11 +01:00 committed by GitHub
parent bfea952eef
commit 02db6882ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,7 +41,7 @@ type CtConfig = BasePlaywrightTestConfig['use'] & {
ctViteConfig?: InlineConfig | (() => Promise<InlineConfig>);
};
const importReactRE = /(^|\n)import\s+(\*\s+as\s+)?React(,|\s+)/;
const importReactRE = /(^|\n|;)import\s+(\*\s+as\s+)?React(,|\s+)/;
const compiledReactRE = /(const|var)\s+React\s*=/;
export function createPlugin(