A calm place to write long-form, and publish it to the open social web.
skypress.blog/
1// @ts-check
2import { defineConfig } from 'astro/config';
3import react from '@astrojs/react';
4import cloudflare from '@astrojs/cloudflare';
5
6// Static by default; the article/homepage routes render on demand (read-through
7// renderer, SP4). Deployed to Cloudflare Pages (SP7). `nodejs_compat` (set in
8// wrangler.toml) lets sanitize-html's Node-style deps run on the edge.
9export default defineConfig( {
10 // Public origin. Override with PUBLIC_SITE_URL when self-hosting (see README / .env.example).
11 site: process.env.PUBLIC_SITE_URL || 'https://skypress.blog',
12 adapter: cloudflare(),
13 // SkyPress doesn't use Astro server sessions (auth is a browser OAuth client).
14 // A no-binding in-memory driver stops the adapter requiring a Cloudflare KV
15 // namespace, keeping the no-database goal (brief §2). Never used at runtime.
16 session: { driver: 'memory' },
17 integrations: [ react() ],
18 vite: {
19 resolve: {
20 // React 18 is required by the @wordpress/* packages (Decision 0001).
21 // Force a single shared instance of React and of every @wordpress store
22 // singleton. core-data/notices/date are installed as multiple nested copies
23 // (no hoisted top-level one); without deduping, each copy registers its store
24 // at load → "Store 'core' is already registered" and a split registry.
25 // Deduping collapses them to one copy in the bundle. (Decision 0021.)
26 dedupe: [
27 'react',
28 'react-dom',
29 '@wordpress/element',
30 '@wordpress/data',
31 '@wordpress/core-data',
32 '@wordpress/notices',
33 '@wordpress/date',
34 '@wordpress/blocks',
35 '@wordpress/block-editor',
36 ],
37 },
38 // @wordpress/* packages expect these globals to exist at bundle time.
39 define: {
40 'process.env.IS_GUTENBERG_PLUGIN': 'undefined',
41 'process.env.IS_WORDPRESS_CORE': 'undefined',
42 },
43 ssr: {
44 // Bundle (don't externalize) the WordPress packages for SSR. Externalized,
45 // `@wordpress/date`'s moment-timezone side-effect import fails to augment
46 // moment (CJS/ESM interop) and crashes at load. Bundling resolves it — the
47 // same reason it works under Vitest. (Decision 0003.)
48 noExternal: [ /^@wordpress\//, /^moment/, 'clsx', 'tslib' ],
49 },
50 },
51} );