@@ -2,14 +2,11 @@ import type { TidewaveConfig } from '../../core';
22import type { TidewaveHandler , TidewaveNext , TidewaveRequest , TidewaveResponse } from '../types' ;
33
44export function createHandleHtml ( config : TidewaveConfig ) : TidewaveHandler {
5- return createHtmlHandler ( config , 'tc.js' , {
6- pathnames : [ '' , '/' , '/tidewave' ] ,
7- } ) ;
5+ return createHtmlHandler ( config , 'tc.js' , { } ) ;
86}
97
108export function createHandleAppHtml ( config : TidewaveConfig ) : TidewaveHandler {
119 return createHtmlHandler ( config , 'control.js' , {
12- pathnames : [ '' , '/' , '/app' , '/tidewave/app' ] ,
1310 headers : {
1411 'Content-Security-Policy' : "base-uri 'self'; frame-ancestors 'self';" ,
1512 } ,
@@ -19,7 +16,7 @@ export function createHandleAppHtml(config: TidewaveConfig): TidewaveHandler {
1916function createHtmlHandler (
2017 config : TidewaveConfig ,
2118 script : 'tc.js' | 'control.js' ,
22- options : { headers ?: Record < string , string > ; pathnames : string [ ] } ,
19+ options : { headers ?: Record < string , string > } ,
2320) : TidewaveHandler {
2421 return async function handleHtml (
2522 req : TidewaveRequest ,
@@ -30,8 +27,8 @@ function createHtmlHandler(
3027 const url = req . url || '/' ;
3128 const pathname = url . split ( '?' ) [ 0 ] || '' ;
3229
33- // Different connect-style middleware stacks may strip different URL prefixes.
34- if ( ! options . pathnames . includes ( pathname ) ) {
30+ // Vite strips the prefix passed to server.use, so we can always check /
31+ if ( pathname !== '/' ) {
3532 return next ( ) ;
3633 }
3734
0 commit comments