Skip to content

Commit

Permalink
fix: ensure injectRoute works during build (#7986)
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re committed Aug 7, 2023
1 parent 2c2e936 commit 8e5a27b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/red-bikes-return.md
@@ -0,0 +1,5 @@
---
'astro': patch
---

Ensure injectRoute is properly handled in `build` as well as `dev`
2 changes: 1 addition & 1 deletion packages/astro/src/core/create-vite.ts
Expand Up @@ -123,7 +123,7 @@ export async function createVite(
htmlVitePlugin(),
jsxVitePlugin({ settings, logging }),
astroPostprocessVitePlugin(),
mode === 'dev' && astroIntegrationsContainerPlugin({ settings, logging }),
astroIntegrationsContainerPlugin({ settings, logging }),
astroScriptsPageSSRPlugin({ settings }),
astroHeadPlugin(),
astroScannerPlugin({ settings, logging }),
Expand Down
Expand Up @@ -17,9 +17,11 @@ export default function astroIntegrationsContainerPlugin({
return {
name: 'astro:integration-container',
configureServer(server) {
if (server.config.isProduction) return;
runHookServerSetup({ config: settings.config, server, logging });
},
async buildStart() {
if (settings.injectedRoutes.length === settings.resolvedInjectedRoutes.length) return;
// Ensure the injectedRoutes are all resolved to their final paths through Rollup
settings.resolvedInjectedRoutes = await Promise.all(
settings.injectedRoutes.map((route) => resolveEntryPoint.call(this, route))
Expand Down

0 comments on commit 8e5a27b

Please sign in to comment.