From 9956fb56c8fd0bb0625828648475e9963304df90 Mon Sep 17 00:00:00 2001 From: StyleShit <32631382+StyleShit@users.noreply.github.com> Date: Sat, 4 Nov 2023 15:42:03 +0200 Subject: [PATCH] refactor: shorten react import regex pattern (#250) --- packages/plugin-react/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-react/src/index.ts b/packages/plugin-react/src/index.ts index 5317087a..28521a94 100644 --- a/packages/plugin-react/src/index.ts +++ b/packages/plugin-react/src/index.ts @@ -113,7 +113,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] { // - import * as React from 'react'; // - import React from 'react'; // - import React, {useEffect} from 'react'; - const importReactRE = /(?:^|\s)import\s+(?:\*\s+as\s+)?React(?:,|\s+)/ + const importReactRE = /\bimport\s+(?:\*\s+as\s+)?React\b/ const viteBabel: Plugin = { name: 'vite:react-babel',