{"id":21606252,"url":"https://github.com/zaydek/universal-react","last_synced_at":"2025-03-18T14:42:07.406Z","repository":{"id":91627664,"uuid":"350005158","full_name":"zaydek/universal-react","owner":"zaydek","description":"Universal React experimentation","archived":false,"fork":false,"pushed_at":"2021-03-24T10:29:34.000Z","size":31,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-24T19:17:23.342Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zaydek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-21T13:22:03.000Z","updated_at":"2021-03-24T10:29:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"c0afae54-2ae6-4caa-b882-f98b1fb06bf0","html_url":"https://github.com/zaydek/universal-react","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/zaydek%2Funiversal-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaydek%2Funiversal-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaydek%2Funiversal-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaydek%2Funiversal-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zaydek","download_url":"https://codeload.github.com/zaydek/universal-react/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244243395,"owners_count":20422059,"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":[],"created_at":"2024-11-24T20:20:03.247Z","updated_at":"2025-03-18T14:42:07.383Z","avatar_url":"https://github.com/zaydek.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# universal-react\n\nThis is a simple experiment to test how to implement SSR / hydration / a minimal vendor chunking strategy for `react`,\n`react-dom`, and esbuild.\n\nThis implementation is inspired by this comment: https://github.com/evanw/esbuild/issues/490#issuecomment-718489865.\nThis repo aims to demonstrate a MVP working example.\n\n## Experiment\n\n`node scripts/client.js` generates `vendor.esbuild.js` and then `client.esbuild.js`, which are already linked in the\n`index.html` file. `vendor.esbuild.js` bundles React and React DOM (vendor dependencies) whereas `app.esbuild.js`\nbundles `src/index.js`. Note that `react` and `react-dom` are referenced via `window.React` and `window.ReactDOM`.\n\n`node scripts/server.js` generates server-side rendered HTML that can in theory be hydrated on the client using the\n`app.esbuild.js` bundle.\n\nAdditionally, user-facing source files do not need to import React. This is because `scripts/server.js` uses\n`inject: [\"shims/react_shim.js\"]`. Note that `scripts/client.js` does not / cannot use the this injection because it\nleads to `Uncaught ReferenceError: require is not defined`. That being said, we don’t need it because `React` and\n`ReactDOM` defer to `window.React` and `window.ReactDOM` automatically. This is only because we’re using `\u003cscript\u003e` not\n`\u003cscript type=\"module\"\u003e`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaydek%2Funiversal-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzaydek%2Funiversal-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaydek%2Funiversal-react/lists"}