@@ -9,9 +9,7 @@ import rehypeAutolinkHeadings from "rehype-autolink-headings";
99import metaTags from "astro-meta-tags" ;
1010import pagefind from "astro-pagefind" ;
1111import deleteUnusedImages from "astro-delete-unused-images" ;
12- import preload from "astro-preload" ;
1312import { execSync } from "node:child_process" ;
14-
1513import compress from "astro-compress" ;
1614
1715let gitVersion = String ( process . env . GIT_VERSION ?? "" ) . slice ( 0 , 7 ) ;
@@ -28,6 +26,44 @@ if (!gitVersion) {
2826 }
2927}
3028
29+ function dontDie ( ) {
30+ return {
31+ name : "dont-die" ,
32+ hooks : {
33+ "astro:config:setup" : ( ) => {
34+ const originalListeners = process
35+ . listeners ( "uncaughtException" )
36+ . slice ( ) ;
37+ process . on ( "uncaughtException" , ( error , origin ) => {
38+ if (
39+ error . message &&
40+ error . message . includes ( "Failed to load remote image" )
41+ ) {
42+ console . warn (
43+ "[dont-die] Caught remote image error:" ,
44+ error . message
45+ ) ;
46+ return ;
47+ }
48+
49+ originalListeners . forEach ( ( listener ) => {
50+ if ( typeof listener === "function" ) {
51+ try {
52+ listener . call ( process , error , origin ) ;
53+ } catch ( listenerError ) {
54+ console . error (
55+ "Error in uncaughtException listener:" ,
56+ listenerError
57+ ) ;
58+ }
59+ }
60+ } ) ;
61+ } ) ;
62+ } ,
63+ } ,
64+ } ;
65+ }
66+
3167// https://astro.build/config
3268export default defineConfig ( {
3369 vite : {
@@ -81,7 +117,6 @@ export default defineConfig({
81117 "/speaker/savannah-ostrowski" : "/speaker/savannah-bailey" ,
82118 } ,
83119 integrations : [
84- preload ( ) ,
85120 mdx ( ) ,
86121 sitemap ( ) ,
87122 tailwind ( {
@@ -90,9 +125,10 @@ export default defineConfig({
90125 metaTags ( ) ,
91126 pagefind ( ) ,
92127 deleteUnusedImages ( ) ,
93- ( await import ( "astro- compress" ) ) . default ( {
128+ compress ( {
94129 SVG : false ,
95130 } ) ,
131+ dontDie ( ) ,
96132 ] ,
97133 output : "static" ,
98134 build : {
0 commit comments