perf: optimize EAS build caching and Metro bundling

Improves build performance by adding platform-specific cache paths including Gradle and iOS Pods directories. Updates cache keys to use app.config.js instead of package.json for more accurate invalidation.

Enhances Metro minification with Hermes-optimized settings, adds ASCII-only output, and enables advanced compression optimizations like dead code elimination and variable reduction.

Configures production environment variables for bundle size optimization across preview and production builds.
This commit is contained in:
Uruk
2025-09-26 16:31:01 +02:00
parent 49ece8d34e
commit edc9c8640d
2 changed files with 45 additions and 14 deletions

View File

@@ -6,8 +6,14 @@
"development": {
"resourceClass": "medium",
"cache": {
"key": "development-{{ checksum \"bun.lock\" \"package.json\" }}",
"paths": ["~/.bun/install/cache", "node_modules", ".expo"]
"key": "dev-{{ checksum \"bun.lock\" \"app.config.js\" }}",
"paths": [
"~/.bun/install/cache",
"node_modules",
".expo",
"android/.gradle",
"ios/Pods"
]
},
"environment": "development",
"developmentClient": true,
@@ -55,19 +61,34 @@
"preview": {
"resourceClass": "large",
"cache": {
"key": "preview-{{ checksum \"bun.lock\" \"package.json\" }}",
"paths": ["~/.bun/install/cache", "node_modules", ".expo"]
"key": "preview-{{ checksum \"bun.lock\" \"app.config.js\" }}",
"paths": [
"~/.bun/install/cache",
"node_modules",
".expo",
"android/.gradle",
"ios/Pods",
".next"
]
},
"distribution": "internal",
"env": {
"EXPO_OPTIMIZE_BUNDLE_SIZE": "1",
"NODE_ENV": "production",
"EXPO_PUBLIC_WRITE_DEBUG": "1"
}
},
"production": {
"resourceClass": "large",
"cache": {
"key": "production-{{ checksum \"bun.lock\" \"package.json\" }}",
"paths": ["~/.bun/install/cache", "node_modules", ".expo"]
"key": "production-{{ checksum \"bun.lock\" \"app.config.js\" }}",
"paths": [
"~/.bun/install/cache",
"node_modules",
".expo",
"android/.gradle",
"ios/Pods"
]
},
"environment": "production",
"channel": "0.36.0",
@@ -77,6 +98,10 @@
},
"ios": {
"image": "latest"
},
"env": {
"EXPO_OPTIMIZE_BUNDLE_SIZE": "1",
"NODE_ENV": "production"
}
},
"production-apk": {

View File

@@ -29,22 +29,28 @@ config.transformer = {
// NEW: Inline requires for 15-30% startup improvement
inlineRequires: true,
// NEW: Minification optimized for streaming apps
// ADVANCED: Hermes-optimized minification for streaming apps
minifierConfig: {
// Keep function names in dev for better debugging
keep_fnames: process.env.NODE_ENV === "development",
mangle: {
keep_fnames: process.env.NODE_ENV === "development",
// Optimize for Hermes bytecode
properties: false, // Safer for dynamic property access in streaming
},
// Compress optimized for media apps
output: {
ascii_only: true,
beautify: false,
semicolons: false,
},
compress: {
// Remove console logs in production
// Production-only optimizations
drop_console: process.env.NODE_ENV === "production",
dead_code: true,
drop_debugger: true,
conditionals: true,
evaluate: true,
unused: true,
reduce_vars: true,
// Keep class names for error reporting
keep_classnames: true,
// Preserve function names for performance profiling
// Preserve function names for performance profiling in dev
keep_fnames: process.env.NODE_ENV === "development",
},
},