File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
packages/astro/src/core/config Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' astro ' : patch
3
+ ---
4
+
5
+ Display useful errors when config loading fails because of Node addons being disabled on Stackblitz
Original file line number Diff line number Diff line change @@ -34,6 +34,13 @@ export async function loadConfigWithVite({
34
34
const config = await import ( pathToFileURL ( configPath ) . toString ( ) + '?t=' + Date . now ( ) ) ;
35
35
return config . default ?? { } ;
36
36
} catch ( e ) {
37
+ // Normally we silently ignore loading errors here because we'll try loading it again below using Vite
38
+ // However, if the error is because of addons being disabled we rethrow it immediately,
39
+ // because when this happens in Stackblitz, the Vite error below will be uncatchable
40
+ // and we want to provide a more helpful error message.
41
+ if ( e && typeof e === 'object' && 'code' in e && e . code === 'ERR_DLOPEN_DISABLED' ) {
42
+ throw e ;
43
+ }
37
44
// We do not need to throw the error here as we have a Vite fallback below
38
45
debug ( 'Failed to load config with Node' , e ) ;
39
46
}
You can’t perform that action at this time.
0 commit comments