diff --git a/packages/void/src/router/compile.ts b/packages/void/src/router/compile.ts index 67b2cd50e..fefb15827 100644 --- a/packages/void/src/router/compile.ts +++ b/packages/void/src/router/compile.ts @@ -414,7 +414,9 @@ export function compileRouteTable( ); } else if ( emitEdgeRules && - (options.fallbackRules?.length || (!options.nodeTarget && options.headerRules?.length)) && + (options.fallbackRules?.length || + options.redirectRules?.some((rule) => rule.status === 200) || + (!options.nodeTarget && options.headerRules?.length)) && !(pages && scan.pages.pages.length > 0) ) { lines.push( diff --git a/packages/void/test/unit/compile.test.ts b/packages/void/test/unit/compile.test.ts index 6f175ebb9..65423e76b 100644 --- a/packages/void/test/unit/compile.test.ts +++ b/packages/void/test/unit/compile.test.ts @@ -1394,6 +1394,12 @@ describe('typed runtime metadata wiring', () => { expect(managed).not.toContain('const __routingRules'); expect(managed).not.toContain('app.notFound'); }); + it('looks rewrite destinations up in static assets', () => { + const rewrite = [{ source: '/', destination: '/index.html', status: 200, force: true }]; + expect(compile({ dev: false, redirectRules: rewrite })).toContain( + 'app.notFound(__createAssetNotFound', + ); + }); it('wires fetch validation, opaque internal routes and optional ISR through runtime callbacks', () => { const code = compileWorkerEntry({ envSchemaModule: { importPath: '/env.ts', helperPath: '/env-helpers.ts' },