File tree Expand file tree Collapse file tree
packages/start/src/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,9 +15,15 @@ export function devServer(): Array<PluginOption> {
1515 return ( ) => {
1616 server . middlewares . use ( async ( req , res ) => {
1717 const webReq = new NodeRequest ( { req, res } ) ;
18+ const { default : packageJSON } = await import ( process . cwd ( ) + "/package.json" , {
19+ with : { type : "json" } ,
20+ } ) ;
1821 const def : {
1922 default : { fetch : ( req : Request ) => Promise < Response > } ;
20- } = await import ( process . cwd ( ) + "/dist/server/entry-server.js" ) ;
23+ } = await import (
24+ process . cwd ( ) +
25+ `/dist/server/entry-server.${ packageJSON . type === "module" ? "js" : "mjs" } `
26+ ) ;
2127 const webRes = await def . default . fetch ( webReq ) ;
2228 if ( webRes . headers . get ( "content-type" ) ?. startsWith ( "text/html" ) ) {
2329 res . setHeader ( "content-encoding" , "identity" ) ;
You can’t perform that action at this time.
0 commit comments