@@ -184,7 +184,7 @@ export default class Server {
184
184
this . nextConfig = loadConfig ( phase , this . dir , conf )
185
185
this . distDir = join ( this . dir , this . nextConfig . distDir )
186
186
this . publicDir = join ( this . dir , CLIENT_PUBLIC_FILES_PATH )
187
- this . hasStaticDir = fs . existsSync ( join ( this . dir , 'static' ) )
187
+ this . hasStaticDir = ! minimalMode && fs . existsSync ( join ( this . dir , 'static' ) )
188
188
189
189
// Only serverRuntimeConfig needs the default
190
190
// publicRuntimeConfig gets it's default in client/index.js
@@ -567,6 +567,9 @@ export default class Server {
567
567
try {
568
568
return await this . run ( req , res , parsedUrl )
569
569
} catch ( err ) {
570
+ if ( this . minimalMode ) {
571
+ throw err
572
+ }
570
573
this . logError ( err )
571
574
res . statusCode = 500
572
575
res . end ( 'Internal Server Error' )
@@ -1835,14 +1838,19 @@ export default class Server {
1835
1838
}
1836
1839
}
1837
1840
} catch ( err ) {
1838
- this . logError ( err )
1839
-
1840
1841
if ( err && err . code === 'DECODE_FAILED' ) {
1842
+ this . logError ( err )
1841
1843
res . statusCode = 400
1842
1844
return await this . renderErrorToHTML ( err , req , res , pathname , query )
1843
1845
}
1844
1846
res . statusCode = 500
1845
- return await this . renderErrorToHTML ( err , req , res , pathname , query )
1847
+ const html = await this . renderErrorToHTML ( err , req , res , pathname , query )
1848
+
1849
+ if ( this . minimalMode ) {
1850
+ throw err
1851
+ }
1852
+ this . logError ( err )
1853
+ return html
1846
1854
}
1847
1855
res . statusCode = 404
1848
1856
return await this . renderErrorToHTML ( null , req , res , pathname , query )
@@ -1863,6 +1871,10 @@ export default class Server {
1863
1871
)
1864
1872
}
1865
1873
const html = await this . renderErrorToHTML ( err , req , res , pathname , query )
1874
+
1875
+ if ( this . minimalMode && res . statusCode === 500 ) {
1876
+ throw err
1877
+ }
1866
1878
if ( html === null ) {
1867
1879
return
1868
1880
}
@@ -2007,9 +2019,11 @@ export default class Server {
2007
2019
}
2008
2020
2009
2021
let nextFilesStatic : string [ ] = [ ]
2010
- nextFilesStatic = recursiveReadDirSync (
2011
- join ( this . distDir , 'static' )
2012
- ) . map ( ( f ) => join ( '.' , relative ( this . dir , this . distDir ) , 'static' , f ) )
2022
+ nextFilesStatic = ! this . minimalMode
2023
+ ? recursiveReadDirSync ( join ( this . distDir , 'static' ) ) . map ( ( f ) =>
2024
+ join ( '.' , relative ( this . dir , this . distDir ) , 'static' , f )
2025
+ )
2026
+ : [ ]
2013
2027
2014
2028
return ( this . _validFilesystemPathSet = new Set < string > ( [
2015
2029
...nextFilesStatic ,
0 commit comments