From 08dd9e408b85680935a968c2cac8ac40cdd674aa Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Mon, 6 Jul 2026 10:02:58 +0330 Subject: [PATCH] feat: enable React Compiler on Next 16 Auto-memoization via babel-plugin-react-compiler (stable in Next 16), compiled through Turbopack's built-in babel. Build and test suite pass. Co-Authored-By: Claude Fable 5 --- next.config.js | 2 ++ package-lock.json | 11 +++++++++++ package.json | 1 + 3 files changed, 14 insertions(+) diff --git a/next.config.js b/next.config.js index 06bda8f..368bbf1 100644 --- a/next.config.js +++ b/next.config.js @@ -5,6 +5,8 @@ const nextConfig = { // متادیتا (canonical/OG/keywords) باید داخل رندر شود نه استریم در . // از Next 15.2 استریم متادیتا پیش‌فرض است؛ این regex همه‌ی UAها را blocking می‌کند. htmlLimitedBots: /.*/, + // React Compiler (پایدار در Next 16) — memoization خودکار کامپوننت‌ها. + reactCompiler: true, images: { remotePatterns: [ { diff --git a/package-lock.json b/package-lock.json index 17d35da..1f02e21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -60,6 +60,7 @@ "@testing-library/react": "^16.3.2", "@testing-library/user-event": "^14.6.1", "@vitejs/plugin-react": "^4.7.0", + "babel-plugin-react-compiler": "^1.0.0", "cross-env": "^10.1.0", "eslint": "^9.39.4", "eslint-config-next": "^16.2.10", @@ -3163,6 +3164,16 @@ "npm": ">=6" } }, + "node_modules/babel-plugin-react-compiler": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/babel-plugin-react-compiler/-/babel-plugin-react-compiler-1.0.0.tgz", + "integrity": "sha512-Ixm8tFfoKKIPYdCCKYTsqv+Fd4IJ0DQqMyEimo+pxUOMUR9cVPlwTrFt9Avu+3cb6Zp3mAzl+t1MrG2fxxKsxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.26.0" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", diff --git a/package.json b/package.json index dd01c76..c37e252 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "@testing-library/react": "^16.3.2", "@testing-library/user-event": "^14.6.1", "@vitejs/plugin-react": "^4.7.0", + "babel-plugin-react-compiler": "^1.0.0", "cross-env": "^10.1.0", "eslint": "^9.39.4", "eslint-config-next": "^16.2.10",