mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-09-16 02:22:17 +00:00
build(cloudflare): add a Cloudflare preview build target
DEPLOY_TARGET now selects the adapter; Netlify stays the default and NODE_ADAPTER keeps working. Cloudflare compresses in transit, so the Worker build aliases $lib/server/compression to a pass-through that leaves the streaming body alone. CI builds and dry-run deploys this target. That is compilation and packaging coverage only, not a production compatibility gate: native sharp still blocks the share-preview route in the Worker runtime.
This commit is contained in:
+6
-15
@@ -2,20 +2,11 @@ import process from 'node:process';
|
||||
import AdapterNode from '@sveltejs/adapter-node';
|
||||
import AdapterNetlify from '@sveltejs/adapter-netlify';
|
||||
|
||||
export const nodeAdapter = process.env.NODE_ADAPTER === 'true';
|
||||
|
||||
// Netlify is the deployment target; the node adapter exists so the service worker
|
||||
// build tests can check the `build/client` layout a Node server produces, and so Lighthouse CI
|
||||
// can audit a production build. Netlify's CDN compresses responses, so precompress here to match.
|
||||
export const nodeAdapter =
|
||||
process.env.NODE_ADAPTER === 'true' || process.env.DEPLOY_TARGET === 'node';
|
||||
export const cloudflareAdapter = process.env.DEPLOY_TARGET === 'cloudflare';
|
||||
export const adapter = nodeAdapter
|
||||
? AdapterNode({ precompress: true })
|
||||
: AdapterNetlify({
|
||||
// if true, will create a Netlify Edge Function rather
|
||||
// than using standard Node-based functions
|
||||
edge: false,
|
||||
|
||||
// if true, will split your app into multiple functions
|
||||
// instead of creating a single one for the entire app.
|
||||
// if `edge` is true, this option cannot be used
|
||||
split: false
|
||||
});
|
||||
: cloudflareAdapter
|
||||
? (await import('@sveltejs/adapter-cloudflare')).default()
|
||||
: AdapterNetlify({ edge: false, split: false });
|
||||
|
||||
Reference in New Issue
Block a user