fix: ensure injectRoute
works during build (#7986)
This commit is contained in:
parent
2c2e9362a2
commit
8e5a27b488
3 changed files with 8 additions and 1 deletions
5
.changeset/red-bikes-return.md
Normal file
5
.changeset/red-bikes-return.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Ensure injectRoute is properly handled in `build` as well as `dev`
|
|
@ -123,7 +123,7 @@ export async function createVite(
|
||||||
htmlVitePlugin(),
|
htmlVitePlugin(),
|
||||||
jsxVitePlugin({ settings, logging }),
|
jsxVitePlugin({ settings, logging }),
|
||||||
astroPostprocessVitePlugin(),
|
astroPostprocessVitePlugin(),
|
||||||
mode === 'dev' && astroIntegrationsContainerPlugin({ settings, logging }),
|
astroIntegrationsContainerPlugin({ settings, logging }),
|
||||||
astroScriptsPageSSRPlugin({ settings }),
|
astroScriptsPageSSRPlugin({ settings }),
|
||||||
astroHeadPlugin(),
|
astroHeadPlugin(),
|
||||||
astroScannerPlugin({ settings, logging }),
|
astroScannerPlugin({ settings, logging }),
|
||||||
|
|
|
@ -17,9 +17,11 @@ export default function astroIntegrationsContainerPlugin({
|
||||||
return {
|
return {
|
||||||
name: 'astro:integration-container',
|
name: 'astro:integration-container',
|
||||||
configureServer(server) {
|
configureServer(server) {
|
||||||
|
if (server.config.isProduction) return;
|
||||||
runHookServerSetup({ config: settings.config, server, logging });
|
runHookServerSetup({ config: settings.config, server, logging });
|
||||||
},
|
},
|
||||||
async buildStart() {
|
async buildStart() {
|
||||||
|
if (settings.injectedRoutes.length === settings.resolvedInjectedRoutes.length) return;
|
||||||
// Ensure the injectedRoutes are all resolved to their final paths through Rollup
|
// Ensure the injectedRoutes are all resolved to their final paths through Rollup
|
||||||
settings.resolvedInjectedRoutes = await Promise.all(
|
settings.resolvedInjectedRoutes = await Promise.all(
|
||||||
settings.injectedRoutes.map((route) => resolveEntryPoint.call(this, route))
|
settings.injectedRoutes.map((route) => resolveEntryPoint.call(this, route))
|
||||||
|
|
Loading…
Reference in a new issue