@@ -94,10 +94,6 @@ export const createCommonRoutes = ({
9494 target : `http://localhost:${ process . env . CYPRESS_INTERNAL_VITE_APP_PORT } /` ,
9595 } )
9696
97- router . get ( '/__vite__/' , ( req , res ) => {
98- ctx . html . appHtml ( ) . then ( ( html ) => res . send ( html ) ) . catch ( ( e ) => res . status ( 500 ) . send ( { stack : e . stack } ) )
99- } )
100-
10197 // TODO: can namespace this onto a "unified" route like __app-unified__
10298 // make sure to update the generated routes inside of vite.config.ts
10399 router . get ( '/__vite__/*' , ( req , res ) => {
@@ -146,15 +142,32 @@ export const createCommonRoutes = ({
146142 router . get ( clientRoute , ( req , res ) => {
147143 debug ( 'Serving Cypress front-end by requested URL:' , req . url )
148144
149- runner . serve ( req , res , testingType === 'e2e' ? 'runner' : 'runner-ct' , {
150- config,
151- testingType,
152- getSpec,
153- getCurrentBrowser,
154- getRemoteState,
155- specsStore,
156- exit,
157- } )
145+ if ( process . env . LAUNCHPAD ) {
146+ ctx . html . appHtml ( )
147+ . then ( ( html ) => res . send ( html ) )
148+ . catch ( ( e ) => res . status ( 500 ) . send ( { stack : e . stack } ) )
149+ } else {
150+ runner . serve ( req , res , testingType === 'e2e' ? 'runner' : 'runner-ct' , {
151+ config,
152+ testingType,
153+ getSpec,
154+ getCurrentBrowser,
155+ getRemoteState,
156+ specsStore,
157+ exit,
158+ } )
159+ }
160+ } )
161+
162+ // serve static assets from the dist'd Vite app
163+ router . get ( [
164+ `${ clientRoute } assets/*` ,
165+ `${ clientRoute } shiki/*` ,
166+ ] , ( req , res ) => {
167+ debug ( 'proxying static assets %s, params[0] %s' , req . url , req . params [ 0 ] )
168+ const pathToFile = getPathToDist ( 'app' , 'assets' , req . params [ 0 ] )
169+
170+ return send ( req , pathToFile ) . pipe ( res )
158171 } )
159172
160173 router . all ( '*' , ( req , res ) => {
0 commit comments