{"id":13602557,"url":"https://github.com/egoist/vue-router-prefetch","last_synced_at":"2025-05-16T15:02:29.984Z","repository":{"id":34047241,"uuid":"167134554","full_name":"egoist/vue-router-prefetch","owner":"egoist","description":"Prefetch links when they are visible in viewport.","archived":false,"fork":false,"pushed_at":"2022-12-09T01:26:13.000Z","size":1629,"stargazers_count":383,"open_issues_count":26,"forks_count":18,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-09T02:41:20.616Z","etag":null,"topics":["prefetch","quicklink","vue","vue-router"],"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/egoist.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":"2019-01-23T07:04:38.000Z","updated_at":"2025-02-28T03:02:39.000Z","dependencies_parsed_at":"2023-01-15T04:15:55.665Z","dependency_job_id":null,"html_url":"https://github.com/egoist/vue-router-prefetch","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Fvue-router-prefetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Fvue-router-prefetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Fvue-router-prefetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Fvue-router-prefetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/egoist","download_url":"https://codeload.github.com/egoist/vue-router-prefetch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254553936,"owners_count":22090415,"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":["prefetch","quicklink","vue","vue-router"],"created_at":"2024-08-01T18:01:28.532Z","updated_at":"2025-05-16T15:02:29.961Z","avatar_url":"https://github.com/egoist.png","language":"JavaScript","funding_links":["https://www.patreon.com/egoist"],"categories":["JavaScript"],"sub_categories":[],"readme":"# vue-router-prefetch\n\n[![NPM version](https://badgen.net/npm/v/vue-router-prefetch)](https://npmjs.com/package/vue-router-prefetch) [![NPM downloads](https://badgen.net/npm/dm/vue-router-prefetch)](https://npmjs.com/package/vue-router-prefetch) [![CircleCI](https://badgen.net/circleci/github/egoist/vue-router-prefetch/master)](https://circleci.com/gh/egoist/vue-router-prefetch/tree/master)\n\n**Please consider [donating](https://www.patreon.com/egoist) to this project's author, [EGOIST](#author), to show your ❤️ and support.**\n\n## Features\n\n- Prefetch links when they are visible in viewport.\n- You don't need to change your code base to make it work.\n- Tiny-size.\n\n## Install\n\n```bash\nyarn add vue-router-prefetch\n```\n\nIf you're using Vue 2, you should install `vue-router-prefetch@1` instead.\n\n## Usage\n\nYou need to use this plugin after `vue-router`:\n\n```js\nimport { createApp } from 'vue'\nimport { createRouter } from 'vue-router'\nimport RouterPrefetch from 'vue-router-prefetch'\n\nconst app = createApp()\nconst router = createRouter()\napp.use(router)\napp.use(RouterPrefetch)\n```\n\nThen you can use `\u003crouter-link\u003e` without any changes, when this component is visible in viewport, it will automatically prefetch the (async) route component.\n\n**Check out the [live demo](https://stackblitz.com/edit/vue-nr9q5u).**\n\nYou can also register it as a new component instead of overriding `\u003crouter-link\u003e`:\n\n```js\napp.use(RouterPrefetch, {\n  componentName: 'QuickLink'\n})\n```\n\nNow you can use it as `\u003cquick-link\u003e` in your app.\n\n## Browser Support\n\n- Without polyfills: Chrome, Firefox, Edge, Opera, Android Browser, Samsung Internet.\n- With [Intersection Observer polyfill](https://github.com/w3c/IntersectionObserver/tree/master/polyfill) ~6KB gzipped/minified: Safari, IE11\n\n## Props\n\nAll [props](https://router.vuejs.org/api/#router-link-props) of `\u003crouter-link\u003e` are still available, additional props are listed below.\n\n### prefetch\n\n- Type: `boolean`\n- Default: `true`\n\nWhether to prefetch the matched route component.\n\nYou can also set `meta.prefetch` on vue-router's `route` object to disable prefetching this route for all `\u003crouter-link\u003e`s:\n\n```js\ncreateRouter({\n  routes: [\n    {\n      path: '/some-async-page',\n      meta: { prefetch: false },\n      component: () =\u003e import('./async-page.vue')\n    }\n  ]\n})\n```\n\nIt's also possible to turn of prefetching globally:\n\n```js\napp.use(RouterPrefetch, {\n  prefetch: false\n})\n```\n\n### prefetchFiles\n\n- Type: `string[]`\n- Examples: `['/foo.css']`\n\nA list of additional files to prefetch. By default we only prefetch the route component.\n\nYou can also set `meta.prefetchFiles` on vue-router's `route` object, it will be merged with the prop value:\n\n```js\ncreateRouter({\n  routes: [\n    {\n      path: '/some-async-page',\n      meta: { prefetchFiles: ['/foo.css'] },\n      component: () =\u003e import('./async-page.vue')\n    }\n  ]\n})\n```\n\n### timeout\n\n- Type: `number`\n- Default: `2000` (ms)\n\nTimeout after which prefetching will occur.\n\n## Credits\n\nInspired by [quicklink](https://github.com/GoogleChromeLabs/quicklink) and [`nuxt-link`](https://github.com/nuxt/nuxt.js/pull/4574/).\n\n## Contributing\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n\n## Author\n\n**vue-router-prefetch** © EGOIST, Released under the [MIT](./LICENSE) License.\u003cbr\u003e\nAuthored and maintained by EGOIST with help from contributors ([list](https://github.com/egoist/vue-router-prefetch/contributors)).\n\n\u003e [Website](https://egoist.sh) · GitHub [@EGOIST](https://github.com/egoist) · Twitter [@\\_egoistlily](https://twitter.com/_egoistlily)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegoist%2Fvue-router-prefetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fegoist%2Fvue-router-prefetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegoist%2Fvue-router-prefetch/lists"}