Statista Remix Stack v1.0.0
This release documents a lot of changes to move the older releases to a stable remix version which builds with vite as well as is optimized for production usage and ease of maintenance.
Highlights
- Use the dev-server provided by remix-tools
- Build the application using vite and the remix-vite plugin
- Allow to deploy to AWS Lambda or AWS ECS by just a few lines of code
- Optimized for minimal production builds
Migration Path
Update the dev-server
- Remove the
server.ctsfile from your project - Replace the
startcommand in your package.json withremix-tools dev-server - Remove the
server.ctsentry from the wireit configuration in yourpackage.json - Remove
hono,@hono/node-server,chokidar,globbyand@pit-shared/lambda-serverfrom your dependencies
Use the vite build system
[!IMPORTANT]
This assumes the update to the remix-tools dev-server was done before
- In the
app/root.tsxupdate the css import toimport stylesheet from "./tailwind.css?url"; - In the
app/root.tsxremove the<LiveReload />component and import - In the
package.jsonupdate thedevscript tocross-env APP_API_ENDPOINT='' pnpm run dev:internal --watch - In the
package.jsonremove thedev:mocksscript - In the
package.jsonupdate thestartscript toremix-tools dev-server - Run
pnpm add -D vite autoprefixerin your terminal - In the
package.jsonupdate thebuildcommand of wireit toremix vite:build - In the
package.jsonupdate thedev:internalcommand of wireit topnpm remix-tools dev-server - In the
package.jsonupdate thedev:internalfiles of wireit to includevite.config.ts - In the
playwright.config.tsupdate thewebServercommand topnpm run build && pnpm start -
Add the file
postcss.config.jsto the root of the repo and paste the following content into it:export default { plugins: { tailwindcss: {}, autoprefixer: {}, }, }; -
In the
remix.env.d.tsfile change@remix-run/devtovite/client -
In the
remix.env.d.tsadd this code to the file:declare module "*?url" { const content: string; export default content; } -
In
tests/e2e/smoke.test.tsadd[debug] [vite] connecting...and[debug] [vite] connected.to theallowedMessages -
Add the file
vite.config.tsto the root of the repo and paste the following content into it:import { vitePlugin as remix } from "@remix-run/dev"; import { flatRoutes } from "remix-flat-routes"; import { defineConfig } from "vite"; import { basePath } from "./remix.config.mjs"; export default defineConfig({ base: `${basePath}/`, plugins: [ remix({ ignoredRouteFiles: ["**/*"], routes: async (defineRoutes) => { return flatRoutes("routes", defineRoutes, { basePath, ignoredRouteFiles: [".*", "**/*.test.{ts,tsx}", "**/__*.*"], }); }, serverModuleFormat: "esm", }), ], });
[!NOTE]
If your project uses a specific typescript paths setup, you have to add the respective vite plugin: vite-tsconfig-paths