Skip to content

injectDevRoute

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

my-integration/index.ts
1
import {
2
defineIntegration,
3
createResolver,
4
injectDevRoute
5
} from "astro-integration-kit";
6
7
export default defineIntegration({
8
// ...
9
setup() {
10
const { resolve } = createResolver(import.meta.url);
11
12
return {
13
hooks: {
14
"astro:config:setup": (params) => {
15
injectDevRoute(params, {
16
pattern: "/foo",
17
entrypoint: resolve("./pages/foo.astro")
18
})
19
}
20
}
21
}
22
}
23
})