{"id":19904350,"url":"https://github.com/alloc/vite-plugin-mobile","last_synced_at":"2025-05-03T00:31:36.198Z","repository":{"id":57393142,"uuid":"300910746","full_name":"alloc/vite-plugin-mobile","owner":"alloc","description":"Vite plugin that serves different modules based on user agent (in dev) and builds separate bundles for mobile and desktop","archived":false,"fork":false,"pushed_at":"2021-01-22T19:42:26.000Z","size":146,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T16:41:48.913Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/alloc.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":"2020-10-03T15:19:40.000Z","updated_at":"2023-08-24T00:31:16.000Z","dependencies_parsed_at":"2022-09-15T02:40:22.640Z","dependency_job_id":null,"html_url":"https://github.com/alloc/vite-plugin-mobile","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fvite-plugin-mobile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fvite-plugin-mobile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fvite-plugin-mobile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fvite-plugin-mobile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alloc","download_url":"https://codeload.github.com/alloc/vite-plugin-mobile/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252126559,"owners_count":21698964,"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":[],"created_at":"2024-11-12T20:28:00.619Z","updated_at":"2025-05-03T00:31:35.789Z","avatar_url":"https://github.com/alloc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vite-plugin-mobile\n\n- Serve different modules based on the [user agent].\n- Build separate bundles for mobile and desktop.\n- Easily share modules between them.\n\n[user agent]: https://en.wikipedia.org/wiki/User_agent\n\n```ts\nimport mobile from 'vite-plugin-mobile'\n\nexport default {\n  plugins: [\n    mobile(),\n  ]\n}\n```\n\n\u0026nbsp;\n\n### Options\n\n- `mobileRoot: string`  \n  The directory containing mobile-only modules.  \n  Defaults to `\"/src/mobile\"`\n\n- `desktopRoot: string`  \n  The directory containing desktop-only modules.  \n  Defaults to `\"/src/desktop\"`\n\n- `mobilePlugins: VitePlugin[]`  \n  Vite plugins for the mobile bundle only.  \n  These are called on `vite build` only.\n\n\u0026nbsp;\n\n### Notes\n\n- Your `vite.config.js` module is executed twice (for desktop then mobile). Your config can check if `process.env.IS_MOBILE` is truthy if it needs to disable certain plugins for the mobile bundle.\n- \"Common chunks\" are *not* generated, so bundles *will* contain duplicate modules.\n- Assets in `public/` are shared between bundles.\n- Your `index.html` is rendered once per bundle.\n- The desktop bundle is used by `${outDir}/index.html`.\n- The mobile bundle is used by `${outDir}/index.mobile.html`.\n- In production, your server will need to manually detect which `.html` page is appropriate based on the `User-Agent` request header. You can use [`wants-mobile`](https://github.com/alloc/wants-mobile) for this.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falloc%2Fvite-plugin-mobile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falloc%2Fvite-plugin-mobile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falloc%2Fvite-plugin-mobile/lists"}