-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
51 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/vike-node/src/runtime/utils/resolve-static-config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { dirname, isAbsolute, join } from 'node:path' | ||
import { fileURLToPath } from 'node:url' | ||
import { isVercel } from '../../utils/isVercel.js' | ||
import type { VikeOptions } from '../types.js' | ||
|
||
export function resolveStaticConfig(static_: VikeOptions['static']): false | { root: string; cache: boolean } { | ||
// Disable static file serving for Vercel | ||
// Vercel will serve static files on its own | ||
// See vercel.json > outputDirectory | ||
if (isVercel()) return false | ||
if (static_ === false) return false | ||
|
||
const argv1 = process.argv[1] | ||
const entrypointDirAbs = argv1 | ||
? dirname(isAbsolute(argv1) ? argv1 : join(process.cwd(), argv1)) | ||
: dirname(fileURLToPath(import.meta.url)) | ||
const defaultStaticDir = join(entrypointDirAbs, '..', 'client') | ||
|
||
if (static_ === true || static_ === undefined) { | ||
return { root: defaultStaticDir, cache: true } | ||
} | ||
if (typeof static_ === 'string') { | ||
return { root: static_, cache: true } | ||
} | ||
return { | ||
root: static_.root ?? defaultStaticDir, | ||
cache: static_.cache ?? true | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.