diff --git a/package.json b/package.json index 3def9f1..56ac60b 100644 --- a/package.json +++ b/package.json @@ -16,19 +16,19 @@ "use-editable": "^2.3.3" }, "devDependencies": { - "@types/react": "^18.0.31", - "@types/react-dom": "^18.0.11", - "@typescript-eslint/eslint-plugin": "^5.57.1", - "@typescript-eslint/parser": "^5.57.1", - "@vitejs/plugin-react": "^4.0.0", - "autoprefixer": "^10.4.14", - "eslint": "^8.38.0", - "eslint-plugin-react-hooks": "^4.6.0", - "eslint-plugin-react-refresh": "^0.3.4", - "postcss": "^8.4.21", + "@types/react": "^18.2.0", + "@types/react-dom": "^18.2.0", + "@typescript-eslint/eslint-plugin": "^7.16.1", + "@typescript-eslint/parser": "^7.16.1", + "@vitejs/plugin-react": "^4.3.1", + "autoprefixer": "^10.4.19", + "eslint": "^9.7.0", + "eslint-plugin-react-hooks": "^4.6.2", + "eslint-plugin-react-refresh": "^0.4.8", + "postcss": "^8.4.39", "sass": "^1.77.8", - "tailwindcss": "^3.2.7", - "typescript": "^4.9.5", - "vite": "^4.3.2" + "tailwindcss": "^3.4.5", + "typescript": "^5.5.3", + "vite": "^5.3.3" } } diff --git a/src/utils/transpile/index.ts b/src/utils/transpile/index.ts index a939057..636393e 100644 --- a/src/utils/transpile/index.ts +++ b/src/utils/transpile/index.ts @@ -43,6 +43,7 @@ export const generateElement = ( )(code); return errorBoundary( + // 作用域在这里定义,用到React,所以需要传入React evalCode(transformed, { React, ...scope }), errorCallback );