{"id":18386112,"url":"https://github.com/wmzy/axios-shadow","last_synced_at":"2025-04-12T01:44:40.793Z","repository":{"id":35116510,"uuid":"208778509","full_name":"wmzy/axios-shadow","owner":"wmzy","description":"A wrapper for axios to code splitting.","archived":false,"fork":false,"pushed_at":"2023-01-04T10:27:55.000Z","size":560,"stargazers_count":2,"open_issues_count":12,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-02T09:18:35.847Z","etag":null,"topics":["axios","code-splitting"],"latest_commit_sha":null,"homepage":"","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/wmzy.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}},"created_at":"2019-09-16T11:02:26.000Z","updated_at":"2023-03-04T04:43:22.000Z","dependencies_parsed_at":"2023-01-15T14:09:48.141Z","dependency_job_id":null,"html_url":"https://github.com/wmzy/axios-shadow","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/wmzy%2Faxios-shadow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wmzy%2Faxios-shadow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wmzy%2Faxios-shadow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wmzy%2Faxios-shadow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wmzy","download_url":"https://codeload.github.com/wmzy/axios-shadow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505937,"owners_count":21115354,"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":["axios","code-splitting"],"created_at":"2024-11-06T01:20:29.902Z","updated_at":"2025-04-12T01:44:40.774Z","avatar_url":"https://github.com/wmzy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/wmzy/axios-shadow.svg?branch=master)](https://travis-ci.org/wmzy/axios-shadow)\n[![Coverage Status](https://coveralls.io/repos/github/wmzy/axios-shadow/badge.svg?branch=master)](https://coveralls.io/github/wmzy/axios-shadow?branch=master)\n# axios-shadow\n\n\u003e A wrapper for axios to code splitting.\n\n## Installation\n\n```bash\nnpm i axios-shadow\n```\n\n## Usage\n\n### Init with a splitting axios\n\nWith [dynamic imports](https://webpack.js.org/guides/code-splitting/#dynamic-imports) we can split `axios` from the main bundle.\n\n```js\nimport axios from 'axios-shadow';\n\naxios.getModule = () =\u003e import('axios');\n// or\naxios.getInstance = () =\u003e import('axios').then(({default: axios}) =\u003e {\n  // you can init global axios defaults and interceptors\n  axios.defaults.baseURL = 'https://api.example.com';\n  // ...\n\n  // custom instance also support\n  // return axios.create();\n  return axios;\n});\n```\n\n### Use a shadow instance\n\n```js\n// axios.js\nimport {create} from 'axios-shadow';\n\nconst axios = create();\n\naxios.getInstance = () =\u003e import('axios').then(m =\u003e m.default.create());\n\nexport default axios;\n```\n\n### Use axios shadow for request\n\n```js\nimport axios from 'axios-shadow';\n// or\nimport axios from './axios';\n\n// all async methods are proxied\naxios(url).then(response =\u003e {});\naxios.get(url).then(response =\u003e {});\n```\n\n## Compatibility Note\n\nThis lib support [these browsers or devices](.broserslistrc) with [these methods or APIs](.eslintrc.js#L27) pollyfilled.\n\n## Workflow\n\n```bash\n# develop\nnpm start\n\n# build\nnpm run build\n\n# test\nnpm test\n\n# commit changes\nnpm run commit\n\n# publish\nnpm publish\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwmzy%2Faxios-shadow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwmzy%2Faxios-shadow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwmzy%2Faxios-shadow/lists"}