const { Parser } = require('acorn')
const JSXParser = Parser.extend(require('acorn-jsx')())
const isReactComponent = Boolean(
JSON.stringify(
JSXParser.parse(fileContent, {
sourceType: 'module',
ecmaVersion: 'latest',
})
).includes('JSXIdentifier')
)
JSX 문자열
- https://github.com/TroyAlford/react-jsx-parser
- https://github.com/FormidableLabs/react-live
- https://github.com/seek-oss/playroom
프로젝트 파일 — iframe 안에서 컴파일·렌더, 의존성은 esm.sh
번들 URL