{"id":22806,"library":"vite-plugin-react-router-amplify-hosting","title":"vite-plugin-react-router-amplify-hosting","description":"Vite plugin for deploying React Router SSR applications to AWS Amplify Hosting. Current version 0.7.0 (supports Vite 5/6/7/8, React Router v7, Node >=20). Generates deploy-manifest.json, bundles a server.mjs entry point, and produces the correct folder structure for Amplify deployment. Requires manual installation of express, compression, morgan, isbot, and @react-router/express. Alternative to Amplify's built-in SSR support with tighter React Router integration.","status":"active","version":"0.7.0","language":"javascript","source_language":"en","source_url":"https://github.com/fossamagna/react-router-amplify","tags":["javascript","amplify","react-router","vite-plugin","typescript"],"install":[{"cmd":"npm install vite-plugin-react-router-amplify-hosting","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-react-router-amplify-hosting","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-react-router-amplify-hosting","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency","package":"@react-router/dev","optional":false},{"reason":"peer dependency","package":"vite","optional":false},{"reason":"required for SSR server","package":"express","optional":false},{"reason":"required for server bundle","package":"compression","optional":false},{"reason":"required for server bundle","package":"morgan","optional":false},{"reason":"required for server bundle","package":"@react-router/express","optional":false},{"reason":"required for server bundle","package":"isbot","optional":true}],"imports":[{"note":"Named export only. Default import will not work.","wrong":"import amplifyHosting from 'vite-plugin-react-router-amplify-hosting'","symbol":"amplifyHosting","correct":"import { amplifyHosting } from 'vite-plugin-react-router-amplify-hosting'"},{"note":"TypeScript type export, cannot be used as runtime value.","wrong":"import { AmplifyHostingOptions } from 'vite-plugin-react-router-amplify-hosting'","symbol":"AmplifyHostingOptions","correct":"import type { AmplifyHostingOptions } from 'vite-plugin-react-router-amplify-hosting'"},{"note":"TypeScript type export, cannot be used as runtime value.","wrong":"import { AmplifyHostingConfig } from 'vite-plugin-react-router-amplify-hosting'","symbol":"AmplifyHostingConfig","correct":"import type { AmplifyHostingConfig } from 'vite-plugin-react-router-amplify-hosting'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport { reactRouter } from '@react-router/dev/vite';\nimport { amplifyHosting } from 'vite-plugin-react-router-amplify-hosting';\n\nexport default defineConfig({\n  plugins: [\n    reactRouter(),\n    amplifyHosting({\n      computeResources: 'serverless',\n    }),\n  ],\n});","lang":"typescript","description":"Minimal Vite config adding the amplify plugin for React Router SSR on Amplify Hosting."},"warnings":[{"fix":"Upgrade Node to v20 or use nvm in CI: nvm install 20 && nvm use 20","message":"Requires Node.js v20 or later. Older Node versions cause build failures.","severity":"breaking","affected_versions":"<20.0.0"},{"fix":"Set artifacts.baseDirectory: .amplify-hosting in amplify.yml","message":"Plugin generates non-standard deploy structure; artifacts.baseDirectory must be .amplify-hosting.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Remove unstable_viteEnvironmentApi flag; use stable configuration.","message":"The unstable_viteEnvironmentApi flag has been experimental in some versions; prefer stable API.","severity":"deprecated","affected_versions":">=0.2.0 <0.5.0"},{"fix":"npm add -D compression express isbot morgan @react-router/express","message":"Missing server dependencies (express, compression, morgan, isbot, @react-router/express) cause SSR build failures.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Upgrade to vite-plugin-react-router-amplify-hosting@0.7.0","message":"Vite 8 support added in 0.7.0; older versions break with Vite 8.","severity":"gotcha","affected_versions":"<0.7.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"npm install express compression morgan @react-router/express","cause":"Missing required runtime dependencies for the server bundle.","error":"Cannot find module 'express' or '@react-router/express'"},{"fix":"Use nvm install 20 && nvm use 20 in preBuild phase of amplify.yml","cause":"Plugin requires Node.js v20 or later due to engine constraints.","error":"Error: Node version (18.x) is not supported. Expected Node.js >=20.0.0"},{"fix":"Set artifacts.baseDirectory: .amplify-hosting in amplify.yml","cause":"Amplify build settings must point to the output directory generated by this plugin.","error":"The 'baseDirectory' should be '.amplify-hosting' but is '.next' or other"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}