I have made some changes to migrate a project to remix vite. I was running in some challenges related to route configuration under vite.config.ts. a few challenges I encountered were couldnt find a stable version of vite plugin so ended up using unstable_vitePlugin as remix. Had to use Promise.resolve which I highly doubt is the right thing to do when setting up routes.
Error: I am encountering You must provide a non-empty routes array to createStaticHandler
My vite.config.ts,
import { unstable_vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
import { remixDevTools } from "remix-development-tools";
import { installGlobals } from "@remix-run/node";
import tsconfigPaths from "vite-tsconfig-paths";
installGlobals();
export default defineConfig({
server: {
port: 3000,
},
plugins: [
remixDevTools(),
remix({
ignoredRouteFiles: ["**/*.css"],
routes(defineRoutes) {
return Promise.resolve(
defineRoutes((route) => {
route("/", "root.tsx", { index: true });
route("about", "routes/about.tsx");
route("test", "routes/test/index.tsx", () => {
route("add", "routes/test/add.tsx", { index: true });
route("delete:testId", "routes/test/delete.$testId.tsx");
route("edit:testId", "routes/test/edit.$testId.tsx");
});
})
);
},
}),
tsconfigPaths(),
],
});
I am not sure what it means by non empty routes array to createStaticHandler. Why does it need an empty array in the first place? Can anyone please provide insights as to how this can be fixed and where does it need an empty array cause I dont seem to have a createStaticHandler function defined. Perhaps the routes are not configured properly in vite.config?