Skip to content

Commit bdf80c7

Browse files
committed
fix(config): guard plugin for EAS Read app config phase
1 parent dfdfa13 commit bdf80c7

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

app.plugin.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const {
99
const DEP_LINE = 'implementation("androidx.core:core-splashscreen:1.0.1")';
1010

1111
function ensureDependency(contents) {
12+
// If gradle file isn't available during introspection, just return as-is.
13+
if (typeof contents !== "string") return contents;
1214
if (contents.includes(DEP_LINE)) return contents; // already present
1315
return contents.replace(
1416
/dependencies\s*\{/m,
@@ -19,7 +21,16 @@ function ensureDependency(contents) {
1921
const withCoreSplashscreenDependency = (config) =>
2022
withAppBuildGradle(config, (config) => {
2123
try {
22-
config.modResults.contents = ensureDependency(config.modResults.contents);
24+
const updated = ensureDependency(config.modResults?.contents);
25+
if (typeof updated === "string") {
26+
config.modResults.contents = updated;
27+
} else {
28+
// During introspection (e.g., EAS Read app config) the file may not exist yet.
29+
WarningAggregator.addWarningAndroid(
30+
"core-splashscreen",
31+
"Skipped adding androidx.core:core-splashscreen; app/build.gradle not available during introspection.",
32+
);
33+
}
2334
} catch (e) {
2435
WarningAggregator.addWarningAndroid(
2536
"core-splashscreen",

0 commit comments

Comments
 (0)