diff --git a/src/renderer/src/components/Playground/files.ts b/src/renderer/src/components/Playground/files.ts index 7b91bb5..4769b99 100644 --- a/src/renderer/src/components/Playground/files.ts +++ b/src/renderer/src/components/Playground/files.ts @@ -106,7 +106,7 @@ export const cssToJs = (file: IFile) => { } export const addReactImport = (code: string) => { - if (!/import\s+React/g.test(code)) { + if (!/^\s*import\s+React\s+/g.test(code)) { return `import React from 'react';\n${code}` } return code