File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change
1
+ // @ts -check
1
2
import fs from 'node:fs' ;
2
3
import path from 'node:path' ;
3
4
import { fileURLToPath } from 'node:url' ;
@@ -22,7 +23,10 @@ async function createServer() {
22
23
23
24
app . use ( '*' , async ( req , res ) => {
24
25
if ( req . originalUrl !== '/' ) {
25
- res . sendFile ( path . resolve ( './dist' + req . originalUrl ) ) ;
26
+ res . writeHead ( 200 , {
27
+ 'Content-Type' : 'application/javascript'
28
+ } ) ;
29
+ res . end ( fs . createReadStream ( path . resolve ( './dist' + req . originalUrl ) ) ) ;
26
30
return ;
27
31
}
28
32
@@ -34,7 +38,7 @@ async function createServer() {
34
38
. replace ( `<!--ssr-html-->` , appHtml )
35
39
. replace ( `<!--ssr-head-->` , headHtml ) ;
36
40
37
- res . end ( html ) ;
41
+ res . writeHead ( 200 , { 'Content-Type' : 'text/html' } ) . end ( html ) ;
38
42
} ) ;
39
43
40
44
return { app, vite } ;
You can’t perform that action at this time.
0 commit comments