fix: get build running
This commit is contained in:
parent
12bbe4730e
commit
cd365d2a08
3 changed files with 11 additions and 18 deletions
|
@ -94,7 +94,7 @@
|
|||
"prismjs": "^1.25.0",
|
||||
"rehype-slug": "^5.0.0",
|
||||
"resolve": "^1.20.0",
|
||||
"rollup": "^2.59.0",
|
||||
"rollup": "~2.59.0",
|
||||
"sass": "^1.43.4",
|
||||
"semver": "^7.3.5",
|
||||
"send": "^0.17.1",
|
||||
|
|
|
@ -12,21 +12,7 @@ type CompilationCache = Map<string, TransformResult>;
|
|||
|
||||
const configCache = new WeakMap<AstroConfig, CompilationCache>();
|
||||
|
||||
// https://github.com/vitejs/vite/discussions/5109#discussioncomment-1450726
|
||||
function isSSR(options: undefined | boolean | { ssr: boolean }): boolean {
|
||||
if (options === undefined) {
|
||||
return false;
|
||||
}
|
||||
if (typeof options === 'boolean') {
|
||||
return options;
|
||||
}
|
||||
if (typeof options == 'object') {
|
||||
return !!options.ssr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
async function compile(config: AstroConfig, filename: string, source: string, viteTransform: TransformHook, opts: boolean | undefined) {
|
||||
async function compile(config: AstroConfig, filename: string, source: string, viteTransform: TransformHook, opts?: { ssr?: boolean }) {
|
||||
// pages and layouts should be transformed as full documents (implicit <head> <body> etc)
|
||||
// everything else is treated as a fragment
|
||||
const filenameURL = new URL(`file://${filename}`);
|
||||
|
@ -57,7 +43,7 @@ async function compile(config: AstroConfig, filename: string, source: string, vi
|
|||
lang,
|
||||
id: filename,
|
||||
transformHook: viteTransform,
|
||||
ssr: isSSR(opts),
|
||||
ssr: Boolean(opts?.ssr),
|
||||
});
|
||||
|
||||
let map: SourceMapInput | undefined;
|
||||
|
@ -91,7 +77,7 @@ export function invalidateCompilation(config: AstroConfig, filename: string) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function cachedCompilation(config: AstroConfig, filename: string, source: string | null, viteTransform: TransformHook, opts: boolean | undefined) {
|
||||
export async function cachedCompilation(config: AstroConfig, filename: string, source: string | null, viteTransform: TransformHook, opts?: { ssr?: boolean; }) {
|
||||
let cache: CompilationCache;
|
||||
if (!configCache.has(config)) {
|
||||
cache = new Map();
|
||||
|
|
|
@ -8087,6 +8087,13 @@ rollup@^2.43.1, rollup@^2.59.0, rollup@^2.60.0:
|
|||
optionalDependencies:
|
||||
fsevents "~2.3.2"
|
||||
|
||||
rollup@~2.59.0:
|
||||
version "2.59.0"
|
||||
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.59.0.tgz#108c61b0fa0a37ebc8d1f164f281622056f0db59"
|
||||
integrity sha512-l7s90JQhCQ6JyZjKgo7Lq1dKh2RxatOM+Jr6a9F7WbS9WgKbocyUSeLmZl8evAse7y96Ae98L2k1cBOwWD8nHw==
|
||||
optionalDependencies:
|
||||
fsevents "~2.3.2"
|
||||
|
||||
run-parallel@^1.1.9:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee"
|
||||
|
|
Loading…
Reference in a new issue