{"id":26243474,"url":"https://github.com/reearth/craco-cesium","last_synced_at":"2025-04-23T13:43:44.727Z","repository":{"id":52756183,"uuid":"174507504","full_name":"reearth/craco-cesium","owner":"reearth","description":"Let's use 🌍Cesium with create-react-app today!","archived":false,"fork":false,"pushed_at":"2024-03-19T05:11:54.000Z","size":505,"stargazers_count":74,"open_issues_count":11,"forks_count":19,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-07T08:37:16.450Z","etag":null,"topics":["cesium","create-react-app","javascript","react"],"latest_commit_sha":null,"homepage":"","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/reearth.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2019-03-08T09:25:37.000Z","updated_at":"2024-10-28T12:50:00.000Z","dependencies_parsed_at":"2024-06-18T15:58:21.107Z","dependency_job_id":"86720299-3d44-463d-b2c9-7563ea480ef0","html_url":"https://github.com/reearth/craco-cesium","commit_stats":null,"previous_names":["darwin-education/craco-cesium"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reearth%2Fcraco-cesium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reearth%2Fcraco-cesium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reearth%2Fcraco-cesium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reearth%2Fcraco-cesium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reearth","download_url":"https://codeload.github.com/reearth/craco-cesium/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250441476,"owners_count":21431176,"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":["cesium","create-react-app","javascript","react"],"created_at":"2025-03-13T10:20:32.475Z","updated_at":"2025-04-23T13:43:44.689Z","avatar_url":"https://github.com/reearth.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# craco-cesium\n\nLet's use 🌍[Cesium](https://cesiumjs.org) with [create-react-app](https://github.com/facebook/create-react-app) today! This is a plugin for [@craco/craco](https://github.com/sharegate/craco). [Resium](https://resium.darwineducation.com) is also recommended.\n\n## NOTE: Unmaintained: Vite is recommended rather thant create-react-app\n\nCurrently create-react-app development is inactive. Now it would be a good time to start using Vite to start development as it is easier and faster. See [Resium documentation](https://resium.reearth.io/installation#5-vite) for more information.\n\nThere are no plans to perform any maintenance on this library. If you have any requests for additional functionality or dependency upgrading, please send us a pull request!\n\n## Very very easy usage\n\n### 1. Create a React project\n\n```sh\nnpm install -g create-react-app\n# or\nyarn global add create-react-app\n\ncreate-react-app example\ncd example\n```\n\n### 2. Install modules\n\nIn your create-react-app project, install modules:\n\n```sh\nnpm install --save @craco/craco craco-cesium cesium resium\n# or\nyarn add @craco/craco craco-cesium cesium resium\n```\n\n### 3. Rewrite npm scripts\n\nRewrite npm scripts in `package.json` as following:\n\n```js\n{\n  // ...\n  \"scripts\": {\n    \"start\": \"craco start\", // react-scripts -\u003e craco\n    \"build\": \"craco build\", // react-scripts -\u003e craco\n    \"test\": \"craco test\",   // react-scripts -\u003e craco\n    \"eject\": \"react-scripts eject\"\n  },\n  // ...\n}\n```\n\n### 4. Create craco config file\n\nCreate `craco.config.js` in the project root:\n\n```js\nmodule.exports = {\n  plugins: [\n    {\n      plugin: require(\"craco-cesium\")()\n    }\n  ]\n};\n```\n\n### 5. Congratulations! 🎉\n\nSet up is complete! Enjoy your Cesium life.\n\nYou can import Cesium as following:\n\n```js\nimport { Viewer, Entity, Color } from \"cesium\";\n```\n\nIf you are using [Resium](https://resium.darwineducation.com), you can import Cesium and Resium as following.\n\n```js\nimport { Color } from \"cesium\";\nimport { Viewer, Entity } from \"resium\";\n```\n\n## 🔥Pro Tip: Enabling HMR\n\n- 💡 Example project is [here](https://github.com/rot1024/create-react-app-cesium-example).\n\n1. `yarn add craco-plugin-react-hot-reload react-hot-loader @hot-loader/react-dom`\n\n⚠️ `@hot-loader/react-dom`'s version should be the same as `react`'s.\n\n2. Add an alias of webpack and `craco-plugin-react-hot-reload` plugin to `craco.config.js`:\n\n```js\nmodule.exports = {\n  webpack: {\n    alias: {\n      \"react-dom\": \"@hot-loader/react-dom\"\n    }\n  },\n  plugins: [\n    { plugin: require(\"craco-plugin-react-hot-reload\") },\n    { plugin: require(\"craco-cesium\")() }\n  ]\n};\n```\n\n4. Wrap root component with hot function in `src/App.js`\n\n```js\nexport default App;\n```\n\nto\n\n```js\nimport { hot } from \"react-hot-loader/root\";\n\n// ~~~~~~~~~~~~~~~~~~~~~~~~~\n\nexport default hot(App);\n```\n\nDone!\n\nPlease refer to [react-hot-loader](https://github.com/gaearon/react-hot-loader) to refer to the details.\n\n## Options\n\nIf the option is omiited, the default options is used:\n\n```js\nCracoCesiumPlugin({\n  loadPartially: false,\n  loadCSSinHTML: true,\n  cesiumPath: \"cesium\",\n});\n```\n\n### `loadPartially`\n\nIf false, whole Cesium will be loaded in HTML and `window.Cesium` is used in `import { ... } from \"cesium\";`. This is the easiest way.\n\nOtherwise, Cesium will be load partially and bundled in the JS. You have to install `strip-pragma-loader` to build Cesium for production: `npm i -S strip-pragma-loader`.\n\nFor more details, refer to [Cesium official tutorial](https://cesium.com/docs/tutorials/cesium-and-webpack/).\n\n### `loadCSSinHTML`\n\nIf true, `Widgets/widgets.css` in Cesium is loaded in HTML.\n\nOtherwise, you have to load the CSS once manually as following.\n\nIf `loadPartially` is true:\n\n```js\nimport \"cesium/Widgets/widgets.css\";\n```\n\nOtherwise:\n\n```js\nimport \"cesium/Build/CesiumUnminified/Widgets/widgets.css\";\n```\n\n### `cesiumPath`\n\nDirectory path destination to copy Cesium files.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freearth%2Fcraco-cesium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freearth%2Fcraco-cesium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freearth%2Fcraco-cesium/lists"}