9e5fafa2b2
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
24 lines
594 B
Markdown
24 lines
594 B
Markdown
---
|
|
'astro': minor
|
|
---
|
|
|
|
Astro exposes the middleware file path to the integrations in the hook `astro:build:ssr`
|
|
|
|
```ts
|
|
// myIntegration.js
|
|
import type { AstroIntegration } from 'astro';
|
|
function integration(): AstroIntegration {
|
|
return {
|
|
name: "fancy-astro-integration",
|
|
hooks: {
|
|
'astro:build:ssr': ({ middlewareEntryPoint }) => {
|
|
if (middlewareEntryPoint) {
|
|
// do some operations
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
The `middlewareEntryPoint` is only defined if the user has created an Astro middleware.
|