@@ -18,13 +18,10 @@ import type { PagesManifest } from '../build/webpack/plugins/pages-manifest-plug
1818import type { BaseNextRequest , BaseNextResponse } from './base-http'
1919import type { PayloadOptions } from './send-payload'
2020
21- import { join , resolve } from 'path'
2221import { parse as parseQs } from 'querystring'
2322import { format as formatUrl , parse as parseUrl } from 'url'
2423import { getRedirectStatus } from '../lib/load-custom-routes'
2524import {
26- SERVERLESS_DIRECTORY ,
27- SERVER_DIRECTORY ,
2825 STATIC_STATUS_PAGES ,
2926 TEMPORARY_REDIRECT_STATUS ,
3027} from '../shared/lib/constants'
@@ -182,6 +179,9 @@ export default abstract class Server {
182179 public readonly hostname ?: string
183180 public readonly port ?: number
184181
182+ protected abstract getDir ( _dir : string ) : string
183+ protected abstract getDistDir ( ) : string
184+ protected abstract getPagesDir ( ) : string
185185 protected abstract getPublicDir ( ) : string
186186 protected abstract getHasStaticDir ( ) : boolean
187187 protected abstract getPagesManifest ( ) : PagesManifest | undefined
@@ -271,7 +271,7 @@ export default abstract class Server {
271271 hostname,
272272 port,
273273 } : Options ) {
274- this . dir = resolve ( dir )
274+ this . dir = this . getDir ( dir )
275275 this . quiet = quiet
276276 this . loadEnvConfig ( { dev } )
277277
@@ -280,7 +280,7 @@ export default abstract class Server {
280280 this . nextConfig = conf as NextConfigComplete
281281 this . hostname = hostname
282282 this . port = port
283- this . distDir = join ( this . dir , this . nextConfig . distDir )
283+ this . distDir = this . getDistDir ( )
284284 this . publicDir = this . getPublicDir ( )
285285 this . hasStaticDir = ! minimalMode && this . getHasStaticDir ( )
286286
@@ -350,15 +350,12 @@ export default abstract class Server {
350350 this . router = new Router ( this . generateRoutes ( ) )
351351 this . setAssetPrefix ( assetPrefix )
352352
353+ const pagesDir = this . getPagesDir ( )
353354 this . incrementalCache = new IncrementalCache ( {
354355 fs : this . getCacheFilesystem ( ) ,
355356 dev,
356357 distDir : this . distDir ,
357- pagesDir : join (
358- this . distDir ,
359- this . _isLikeServerless ? SERVERLESS_DIRECTORY : SERVER_DIRECTORY ,
360- 'pages'
361- ) ,
358+ pagesDir,
362359 locales : this . nextConfig . i18n ?. locales ,
363360 max : this . nextConfig . experimental . isrMemoryCacheSize ,
364361 flushToDisk : ! minimalMode && this . nextConfig . experimental . isrFlushToDisk ,
0 commit comments