{"id":13417231,"url":"https://github.com/yzydeveloper/vite-plugin-mpa-plus","last_synced_at":"2025-05-09T00:02:37.075Z","repository":{"id":42198099,"uuid":"494154649","full_name":"yzydeveloper/vite-plugin-mpa-plus","owner":"yzydeveloper","description":"More flexible MPA (multipage application) supports html template","archived":false,"fork":false,"pushed_at":"2024-04-18T01:08:00.000Z","size":152,"stargazers_count":86,"open_issues_count":2,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-13T00:03:53.679Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/yzydeveloper.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-19T16:47:18.000Z","updated_at":"2025-03-14T08:13:20.000Z","dependencies_parsed_at":"2024-01-07T18:04:28.422Z","dependency_job_id":"af66231a-c4df-461a-9087-bce26b5b0cb5","html_url":"https://github.com/yzydeveloper/vite-plugin-mpa-plus","commit_stats":{"total_commits":75,"total_committers":5,"mean_commits":15.0,"dds":0.2666666666666667,"last_synced_commit":"d312d14b4c377af6a6bf7c7a8ed55a3e188afc29"},"previous_names":["yzydeveloper/vite-plugin-multiple-page"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzydeveloper%2Fvite-plugin-mpa-plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzydeveloper%2Fvite-plugin-mpa-plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzydeveloper%2Fvite-plugin-mpa-plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzydeveloper%2Fvite-plugin-mpa-plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yzydeveloper","download_url":"https://codeload.github.com/yzydeveloper/vite-plugin-mpa-plus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253166502,"owners_count":21864475,"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-07-30T22:00:34.259Z","updated_at":"2025-05-09T00:02:36.889Z","avatar_url":"https://github.com/yzydeveloper.png","language":"TypeScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Framework-agnostic Plugins"],"readme":"# vite-plugin-mpa-plus\n\nSimilar to the [pages](https://cli.vuejs.org/en/config/#pages) option of vue-cli\n\n## Features\n\n- EJS template capability\n- Multi-page/Single-page application support\n- Support custom entry\n- Support custom template\n- Support `connect-history-api-fallback`\n\n## Install\n\n```bash\npnpm install vite-plugin-mpa-plus\n```\n\n## Usage\n\nAdd plugin to your vite.config.ts:\n\n### Multi-page application configuration\n```ts\nimport { defineConfig } from 'vite'\nimport mpaPlugin from 'vite-plugin-mpa-plus'\n\nexport defineConfig({\n    plugins: [\n        mpaPlugin({\n            pages: {\n                app1: {\n                    entry: 'src/app/app1/index.ts',\n                    filename: '/pages/app1.html',\n                    template: 'src/app/app1/index.html',\n                    inject: {\n                        data: {\n                            title: \"mpa-app1\"\n                        }\n                    }\n                },\n                app2: {\n                    entry: 'src/app/app2/index.ts',\n                    filename: '/pages/app2.html',\n                    template: 'src/app/app2/index.html',\n                    inject: {\n                        data: {\n                            title: \"mpa-app2\"\n                        }\n                    }\n                }\n            }\n        })\n    ]\n})\n```\n\n### Signal-page application configuration\n\n```ts\nimport { defineConfig } from 'vite'\nimport mpaPlugin from 'vite-plugin-mpa-plus'\n\nexport defineConfig({\n    plugins: [\n        mpaPlugin({\n            entry: 'src/main.ts',\n            inject: {\n                data: {\n                    title: 'spa'\n                }\n            }\n        })\n    ]\n})\n```\n\n### historyApiFallback configuration\n\n```ts\nimport type { Rewrite, Pages } from 'vite-plugin-mpa-plus'\nimport { defineConfig } from 'vite'\nimport path from 'path'\nimport mpaPlugin from 'vite-plugin-mpa-plus'\n\nconst entrys = ['app1', 'app2']\nconst rewrites:Rewrite = []\nconst pages = entrys.reduce\u003cPages\u003e((result, pageName) =\u003e {\n    result[pageName] = {\n        entry: `src/app/${pageName}/index.ts`,\n        filename: `/pages/${pageName}.html`,\n        template: `src/app/${pageName}/index.html`,\n        inject: {\n            data: {\n                title: 'mpa'\n            }\n        }\n    }\n    rewrites.push({\n        from: `/view-${pageName}`,\n        to: `/pages/${pageName}.html`\n    })\n    return result\n}, {})\n\nexport default defineConfig(() =\u003e {\n    return {\n        plugins: [\n            mpaPlugin({\n                pages,\n                historyApiFallback: {\n                    rewrites\n                }\n            }),\n        ],\n    }\n})\n\n```\n\n## Development\n\n```sh\n# Install all dependencies\npnpm install\n\n# Build or dev core package\npnpm --filter vite-plugin-mpa-plus build\npnpm --filter vite-plugin-mpa-plus dev\n\n# Build playground example\npnpm --filter playground-mpa build\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyzydeveloper%2Fvite-plugin-mpa-plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyzydeveloper%2Fvite-plugin-mpa-plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyzydeveloper%2Fvite-plugin-mpa-plus/lists"}