@greenwood/cli
Advanced tools
Comparing version 0.28.0-alpha.2 to 0.28.0-alpha.3
{ | ||
"name": "@greenwood/cli", | ||
"version": "0.28.0-alpha.2", | ||
"version": "0.28.0-alpha.3", | ||
"description": "Greenwood CLI.", | ||
@@ -68,3 +68,3 @@ "type": "module", | ||
}, | ||
"gitHead": "59b4e3b01b728797835664368d4a16183cfcf957" | ||
"gitHead": "34765cb4fa4ff6129bb4fe7e94c5c336766297e2" | ||
} |
@@ -11,4 +11,4 @@ import { getStaticServer, getHybridServer } from '../lifecycles/serve.js'; | ||
const hasApisDir = await checkResourceExists(compilation.context.apisDir); | ||
const hasDynamicRoutes = compilation.graph.filter(page => page.isSSR && ((page.data.hasOwnProperty('static') && !page.data.static) || !compilation.config.prerender)); | ||
const server = hasDynamicRoutes.length > 0 || hasApisDir ? getHybridServer : getStaticServer; | ||
const hasDynamicRoutes = compilation.graph.find(page => page.isSSR && !page.data.static); | ||
const server = (hasDynamicRoutes && !compilation.config.prerender) || hasApisDir ? getHybridServer : getStaticServer; | ||
@@ -15,0 +15,0 @@ (await server(compilation)).listen(port, () => { |
@@ -164,7 +164,9 @@ import fs from 'fs/promises'; | ||
const isSPA = compilation.graph.find(page => page.isSPA); | ||
const { isSSR } = matchingRoute || {}; | ||
const isStatic = matchingRoute && !isSSR || isSSR && compilation.config.prerender || isSSR && matchingRoute.data.static; | ||
if (isSPA || (matchingRoute && !matchingRoute.isSSR) || url.pathname.split('.').pop() === 'html') { | ||
if (isSPA || (matchingRoute && isStatic) || url.pathname.split('.').pop() === 'html') { | ||
const pathname = isSPA | ||
? 'index.html' | ||
: matchingRoute | ||
: isStatic | ||
? matchingRoute.outputPath | ||
@@ -171,0 +173,0 @@ : url.pathname; |
146299
3393