russellchoudhury
russellchoudhury
SSolidJS
Created by russellchoudhury on 9/3/2024 in #support
SSG/SSR on specific paths for landing page
My main web app has SSR set to false, I would like my landing page to be SSG (or SSR) for SEO purposes, how can I achieve this in one solid start app here is my current app.config.ts
import { defineConfig } from '@solidjs/start/config'
import { cloudflare } from 'unenv'

export default defineConfig({
vite: () => ({
build: {
target: 'es2020',
},
}),
server: {
preset: 'cloudflare-pages',
unenv: cloudflare,
rollupConfig: {
external: ['__STATIC_CONTENT_MANIFEST', 'node:async_hooks'],
},
prerender: {
routes: ['/'],
ignore: ['/app/*', '/auth/*', '/api/*'],
},
},
middleware: './src/middleware.ts',
ssr: false,
})
import { defineConfig } from '@solidjs/start/config'
import { cloudflare } from 'unenv'

export default defineConfig({
vite: () => ({
build: {
target: 'es2020',
},
}),
server: {
preset: 'cloudflare-pages',
unenv: cloudflare,
rollupConfig: {
external: ['__STATIC_CONTENT_MANIFEST', 'node:async_hooks'],
},
prerender: {
routes: ['/'],
ignore: ['/app/*', '/auth/*', '/api/*'],
},
},
middleware: './src/middleware.ts',
ssr: false,
})
20 replies
SSolidJS
Created by russellchoudhury on 8/26/2024 in #support
"use server" working locally but not when deployed
why does this code not work when deployed but works locally in dev? removing "use server" makes it work but for some reason when its there my output is just "Signed in as" logs also do not show that getAuth is running register.tsx
import { createAsync } from "@solidjs/router";
import { getAuth } from '~/lib/server/auth'


export default function Register() {
const auth = createAsync(() => getAuth(), { deferStream: true })

return (
<p>Signed in as {auth()?.user.email}</p>
)
}
import { createAsync } from "@solidjs/router";
import { getAuth } from '~/lib/server/auth'


export default function Register() {
const auth = createAsync(() => getAuth(), { deferStream: true })

return (
<p>Signed in as {auth()?.user.email}</p>
)
}
~/lib/server/auth
import { cache } from "@solidjs/router";

export const getAuth = cache(async () => {
"use server"

console.log("getAuth")
return {
user: {
email: 'test@test.com',
}
}
}, 'getAuth')
import { cache } from "@solidjs/router";

export const getAuth = cache(async () => {
"use server"

console.log("getAuth")
return {
user: {
email: 'test@test.com',
}
}
}, 'getAuth')
--- deployed on cloudflare
server: {
preset: 'cloudflare-pages',
unenv: cloudflare,

rollupConfig: {
external: ['__STATIC_CONTENT_MANIFEST', 'node:async_hooks'],
},
},
middleware: './src/middleware.ts',
ssr: false,
server: {
preset: 'cloudflare-pages',
unenv: cloudflare,

rollupConfig: {
external: ['__STATIC_CONTENT_MANIFEST', 'node:async_hooks'],
},
},
middleware: './src/middleware.ts',
ssr: false,
16 replies