{"id":21358035,"url":"https://github.com/tom910/react-async-loading","last_synced_at":"2025-06-18T06:33:44.524Z","repository":{"id":65372124,"uuid":"66755237","full_name":"Tom910/react-async-loading","owner":"Tom910","description":"Code splitting to React and Webpack","archived":false,"fork":false,"pushed_at":"2016-08-30T21:18:47.000Z","size":20,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-21T12:07:58.436Z","etag":null,"topics":["async-component","code-splitting","react"],"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/Tom910.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":"2016-08-28T07:21:13.000Z","updated_at":"2024-09-15T12:40:52.000Z","dependencies_parsed_at":"2023-01-19T23:16:31.169Z","dependency_job_id":null,"html_url":"https://github.com/Tom910/react-async-loading","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tom910%2Freact-async-loading","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tom910%2Freact-async-loading/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tom910%2Freact-async-loading/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tom910%2Freact-async-loading/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tom910","download_url":"https://codeload.github.com/Tom910/react-async-loading/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225844813,"owners_count":17533161,"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":["async-component","code-splitting","react"],"created_at":"2024-11-22T05:14:01.318Z","updated_at":"2024-11-22T05:14:01.979Z","avatar_url":"https://github.com/Tom910.png","language":"JavaScript","readme":"# React Async Loading\n\n```js\nimport { asyncComponent } from 'react-async-loading';\n// And export module...\nexport default asyncComponent(() =\u003e System.import('./Link.js'));\n```\n\nCode splitting to React and Webpack\n\n## Install\n\n- Install the module: `npm install --save react-async-loading`\n- Add plugin to you Webpack config:\n```js\nnew webpack.optimize.CommonsChunkPlugin({\n  children: true, // necessary for splitting children chunks\n  async: true // necessary for async loading chunks\n})\n```\n\n## Example\n- [Simple](https://github.com/Tom910/react-async-loading/tree/master/example)\n\n## API\n\n### asyncComponent\n#### Usage\n```jsx\nasyncComponent(() =\u003e System.import('./Link.js'), { placeholder: \u003cdiv\u003eLoading\u003c/div\u003e })\n```\nor\n```jsx\nasyncComponent(() =\u003e require.ensure([], (require) =\u003e require('./Button.js'), 'Button'), { placeholder: \u003cdiv\u003eLoading\u003c/div\u003e })\n```\n\n#### Props\n##### - 1 argument\nRequired. There should be a function of the module is loaded. Webpack supports two varieties of modules. `SystemJS` and `require.ensure`. The only difference is in the syntax, and that you can specify the name of the chunk in require.ensure\n- ``` System.import('./Link.js') ```\n- ``` require.ensure([], (require) =\u003e require('./Button.js'), 'Button') ```\n\nWebpack compiles\n- `0.chunk.js` - numbers name in `SystemJS`\n- `Button.chunk.js` - we set the name in `require.ensure`\n\n##### - 2 argument\nSetting options. Now available `placeholder` option, which displays the item is loaded chunk\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftom910%2Freact-async-loading","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftom910%2Freact-async-loading","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftom910%2Freact-async-loading/lists"}