{"id":15311809,"url":"https://github.com/aslemammad/react-worker-components-plugin","last_synced_at":"2026-03-06T01:01:31.302Z","repository":{"id":43953579,"uuid":"443427260","full_name":"Aslemammad/react-worker-components-plugin","owner":"Aslemammad","description":"⚡ Something like react server components, but web workers instead of a server","archived":false,"fork":false,"pushed_at":"2022-02-13T08:43:38.000Z","size":224,"stargazers_count":105,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T01:28:39.366Z","etag":null,"topics":["next","react","server-components","vite","webpack","worker"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Aslemammad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-31T21:22:57.000Z","updated_at":"2025-02-11T01:16:42.000Z","dependencies_parsed_at":"2022-09-02T12:31:21.152Z","dependency_job_id":null,"html_url":"https://github.com/Aslemammad/react-worker-components-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aslemammad%2Freact-worker-components-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aslemammad%2Freact-worker-components-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aslemammad%2Freact-worker-components-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aslemammad%2Freact-worker-components-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Aslemammad","download_url":"https://codeload.github.com/Aslemammad/react-worker-components-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248703693,"owners_count":21148210,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["next","react","server-components","vite","webpack","worker"],"created_at":"2024-10-01T08:34:37.376Z","updated_at":"2026-03-06T01:01:31.231Z","avatar_url":"https://github.com/Aslemammad.png","language":"TypeScript","readme":"# react-worker-components-plugin ⚡\n\n![](https://img.shields.io/static/v1?label=mode\u0026message=experimental\u0026color=red)\n\n\u003e *something like react server components, but web workers instead of a server*\n\n**react-worker-components-plugin** is a plugin that renders components in web workers and not in the main thread, which helps in rendering blocking components in a non-blocking way.  This project is based on the experimental [react-worker-components](https://github.com/dai-shi/react-worker-components).\n\n- ⚡ Fast\n- 💥 Powered by `Suspense`\n- 🔥 Easy to use\n\n\u003cbr /\u003e\n\nYou just need to create a file with a name that contains `.worker.`, in case you want to render its components in a Worker. \n\n## Example \n[Try online (Stackblitz)](https://stackblitz.com/edit/vitejs-vite-eneunr)\n\n### `Fib.worker.tsx`\n```tsx\nconst fib = (i: number): number =\u003e {\n  const result = i \u003c= 1 ? i : fib(i - 1) + fib(i - 2);\n  return result;\n};\n\nexport const Fib = ({ num, children }) =\u003e {\n  const fibNum = fib(num); \n\n  return (\n    \u003cdiv\u003e\n      \u003cspan\u003efib of number {num}: {fibNum}\u003c/span\u003e\n      {children}\n    \u003c/div\u003e\n  );\n};\n```\n### `App.tsx`\n```tsx\nimport { Fib } from './Fib.worker'\n\nfunction App() {\n  const [count, setCount] = useState(40);\n  return (\n    \u003cdiv\u003e\n      \u003ch1\u003eWorkers\u003c/h1\u003e\n      \u003cspan\u003eCount: {count}\u003c/span\u003e\n      \u003cbutton id=\"increment\" type=\"button\" onClick={() =\u003e setCount(count + 1)}\u003e\n        +1\n      \u003c/button\u003e\n      \u003cbutton\n        id=\"decrement\"\n        type=\"button\"\n        onClick={() =\u003e setCount((c) =\u003e c - 1)}\n      \u003e\n        -1\n      \u003c/button\u003e\n      \u003cSuspense fallback={\u003cdiv\u003eLoading...\u003c/div\u003e}\u003e\n\t      \u003cFib num={count} /\u003e\n      \u003c/Suspense\u003e\n    \u003c/div\u003e\n  );\n}\n\nexport default App;\n\n```\n\n![chrome-capture](https://user-images.githubusercontent.com/37929992/153716004-8e4bd404-47ce-4a60-8931-db11018a4967.gif)\n\n\n## Install\n```\nnpm install -D react-worker-components-plugin\n```\n ## Plugins\n ### Vite \n This plugin for now works in Vite, and it's tested properly there.\n ```js\n // vite.config.js\nimport { defineConfig } from \"vite\";\nimport { vite as rwc } from \"react-worker-components-plugin\";\n\nexport default defineConfig({\n  plugins: [rwc()]\n});\n```\n\n### Next/Webpack/...\nIt's planned to support other bundlers, any help is appreciated in that case!\n\n## Contributing \nPlease try the plugin, find issues, report and fix them by sending Pull requests and issues! I appreciate that. \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faslemammad%2Freact-worker-components-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faslemammad%2Freact-worker-components-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faslemammad%2Freact-worker-components-plugin/lists"}