{"id":16493842,"url":"https://github.com/linbudu599/esbuild-react-app","last_synced_at":"2025-07-30T17:33:32.289Z","repository":{"id":37027359,"uuid":"426185542","full_name":"linbudu599/esbuild-react-app","owner":"linbudu599","description":"ESBuild powered react application(from CRA template)","archived":false,"fork":false,"pushed_at":"2023-01-31T23:31:31.000Z","size":1701,"stargazers_count":2,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-25T13:52:19.085Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linbudu599.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-11-09T10:30:33.000Z","updated_at":"2023-03-09T02:24:27.000Z","dependencies_parsed_at":"2023-01-26T12:45:32.364Z","dependency_job_id":null,"html_url":"https://github.com/linbudu599/esbuild-react-app","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/linbudu599/esbuild-react-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linbudu599%2Fesbuild-react-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linbudu599%2Fesbuild-react-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linbudu599%2Fesbuild-react-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linbudu599%2Fesbuild-react-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linbudu599","download_url":"https://codeload.github.com/linbudu599/esbuild-react-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linbudu599%2Fesbuild-react-app/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267911322,"owners_count":24164460,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-11T14:10:54.062Z","updated_at":"2025-07-30T17:33:32.266Z","avatar_url":"https://github.com/linbudu599.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ESBuild + React App\n\nThis project is a sample project showing how to use [ESBuild](https://esbuild.github.io/) as a compiler in React project, including **the configuration of React, ReactDOM mounts under window via plugins with precompiled files**, and **the required [ESBuild build options](https://esbuild.github.io/api/#simple-options)**, and the `Live-Server` etc.\n\nYou can refer to the [build.ts](build.ts) and [plugin.ts](preserve-external-dep.plugin.ts) files to learn how to use ESBuild for simple replacements of Webpack.\n\n**Note: This project has not been validated in a production environment, and it is not recommended that you do so.**\n\n## Get Started\n\n```bash\nyarn\n\n# execute build script, and use serve to start up a server.\nyarn start\n```\n\n## Further\n\nAs ESBuild does not implement a module system like Webpack, the [`external`](https://esbuild.github.io/api/#external) property in ESBuild will in some cases not behave the same way as it does under a Webpack project.\n\nIn Webpack project, we've gotten used to the idea that webpack can handle mount under `window` with the related configuration, which will automatically inject code like `module.exports = React` into the compiled code, and the application code will refer to `window` when it executes `require(\"react\")`.\n\nSo to archive this in ESBuild, we use an extra file in this project, packaged as `inject.js`, which contains the source code for `React`, `ReactDOM`, and mounts it under `window` at the end of the file. Then, we convert the application's import of react to go under `window`.\n\nTo ensure that the variables are mounted before the application is loaded, we need to ensure that `inject.js` is executed before `index.js`. In fact, a more common way to do this would be to use a CDN to do the `inject.js` work.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinbudu599%2Fesbuild-react-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinbudu599%2Fesbuild-react-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinbudu599%2Fesbuild-react-app/lists"}