11// @ts -check
22
3+ import { rm } from "node:fs/promises" ;
34import { fileURLToPath } from "node:url" ;
45import mdx from "@astrojs/mdx" ;
56import sitemap from "@astrojs/sitemap" ;
@@ -11,14 +12,29 @@ import { remarkMermaidAscii } from "./src/plugins/remark-mermaid-ascii.ts";
1112import cloudflare from "@astrojs/cloudflare" ;
1213import sentry from "@sentry/astro" ;
1314
15+ /**
16+ * Vite plugin that removes public/assets from the build output. These files
17+ * are served externally and would otherwise cause miniflare to reject the
18+ * build (e.g. files exceeding Cloudflare's 25 MiB asset size limit).
19+ */
20+ function excludePublicAssets ( ) {
21+ return {
22+ name : "exclude-public-assets" ,
23+ enforce : "post" ,
24+ async closeBundle ( ) {
25+ const assetsDir = fileURLToPath (
26+ new URL ( "./dist/client/assets" , import . meta. url ) ,
27+ ) ;
28+ await rm ( assetsDir , { recursive : true , force : true } ) ;
29+ } ,
30+ } ;
31+ }
32+
1433// https://astro.build/config
1534export default defineConfig ( {
1635 site : "https://just-be.dev" ,
1736 output : "static" ,
1837 adapter : cloudflare ( ) ,
19- experimental : {
20- liveContentCollections : true ,
21- } ,
2238 integrations : [
2339 sentry ( {
2440 dsn : process . env . PUBLIC_SENTRY_DSN ,
@@ -39,6 +55,7 @@ export default defineConfig({
3955 UnoCSS ( ) ,
4056 ] ,
4157 vite : {
58+ plugins : [ excludePublicAssets ( ) ] ,
4259 resolve : {
4360 alias : {
4461 "@" : fileURLToPath ( new URL ( "./src" , import . meta. url ) ) ,
0 commit comments