exclude expo notifications from web bundle

This commit is contained in:
Samuel Newman
2026-05-25 19:08:19 +03:00
parent ad0df3cf43
commit 28ab0ba9cd
7 changed files with 236 additions and 6 deletions
+20
View File
@@ -277,6 +277,11 @@ export default defineConfig(
message:
'React is already in the global type namespace. Use named imports for runtime modules.',
},
{
name: 'expo-notifications',
message:
'Import the helpers from #/lib/notifications/expo-helpers (or the hooks from #/lib/notifications/notifications) instead. expo-notifications is stubbed on web; importing it directly pulls ~70KB of dead weight into the web bundle.',
},
],
},
],
@@ -312,6 +317,21 @@ export default defineConfig(
},
},
/**
* Native-only files that legitimately wrap expo-notifications. The .web.ts
* counterparts to these files don't import the package.
*/
{
files: [
'src/lib/notifications/notifications.ts',
'src/lib/notifications/expo-helpers.ts',
'src/lib/hooks/useNotificationHandler.ts',
],
rules: {
'no-restricted-imports': 'off',
},
},
/**
* Test files configuration
*/