refactor: migrate app.config and Expo config plugins to TypeScript (#1718)

This commit is contained in:
Gauvain
2026-06-30 09:03:47 +02:00
committed by GitHub
parent 97b6a912e0
commit 286a3cad47
19 changed files with 216 additions and 89 deletions

View File

@@ -0,0 +1,36 @@
import { type ConfigPlugin, withAppBuildGradle } from "expo/config-plugins";
const withExcludeMedia3Dash: ConfigPlugin = (config) => {
return withAppBuildGradle(config, (config) => {
const contents = config.modResults.contents;
// Add exclusion for duplicate media3 modules before dependencies block
const exclusionBlock = `
configurations.all {
// Exclude duplicate media3 modules to avoid conflict between react-native-video and react-native-track-player
exclude group: 'androidx.media3', module: 'media3-exoplayer-dash'
exclude group: 'androidx.media3', module: 'media3-exoplayer-smoothstreaming'
exclude group: 'androidx.media3', module: 'media3-exoplayer-rtsp'
}
`;
// Check if exclusion already exists
if (contents.includes("media3-exoplayer-dash")) {
return config;
}
// Insert before the dependencies block
const dependenciesIndex = contents.indexOf("dependencies {");
if (dependenciesIndex !== -1) {
config.modResults.contents =
contents.slice(0, dependenciesIndex) +
exclusionBlock +
"\n" +
contents.slice(dependenciesIndex);
}
return config;
});
};
export default withExcludeMedia3Dash;