injectDevRoute allows you to inject a route in development only. For example:
injectDevRoute
import { createResolver, defineIntegration } from "astro-integration-kit";import { injectDevRoutePlugin } from "astro-integration-kit/plugins"; export default defineIntegration({ name: "my-integration", plugins: [injectDevRoutePlugin], setup() { const { resolve } = createResolver(import.meta.url); return { "astro:config:setup": ({ injectDevRoute }) => { injectDevRoute({ pattern: "/foo", entrypoint: resolve("./pages/foo.astro") }) } } }})
import type { AstroIntegration } from "astro";import { createResolver } from "astro-integration-kit";import { injectDevRoute } from "astro-integration-kit/utilities"; export default function myIntegration(): AstroIntegration { const { resolve } = createResolver(import.meta.url); return { name: "my-integration", hooks: { "astro:config:setup": ({ command, injectRoute }) => { injectDevRoute({ command, injectRoute, injectedRoute: { pattern: "/foo", entrypoint: resolve("./pages/foo.astro") }, }) }, } }}