Skip to content

injectDevRoute

injectDevRoute allows you to inject a route in development only. For example:

my-integration/index.ts
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")
})
}
}
}
})