본문 바로가기
React Native

[expo] eas buil 및 배포하기 및 재배포

by 어느새벽 2025. 4. 29.

expo eas 공식 문서 보고 그대로 따라하면 되는게 그냥 복기할겸 한번 더 남겨야징

 

1. 최신 eas cli 설치

npm install -g eas-cli
yarn global add eas-cli

 

2. expo 계정 로그인

eas login

 

3. 프로젝트 구성

eas build:configure

 

여기서 안드로이드 빌드 중 에러가 날 수 있음

🤖 Android build
The field "cli.appVersionSource" is not set, but it will be required in the future. Learn more
It looks like that you are using a custom metro.config.js that does not extend @expo/metro-config.
This can result in unexpected and hard to debug issues, like missing assets in the production bundle.
We recommend you to abort, fix the metro.config.js, and try again.
Learn more on customizing Metro
✔ Would you like to abort? … yes
Aborting...
EEXIT: 1
    Error: build command failed.

 

위 에러는 아래 파일들을 수정하면 해결됨! 

 

4. eas.json 파일 수정하기 

{
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
    "preview": {
      "distribution": "internal"
    },
    "production": {}
  }
}
  • cli.appVersionSource: 이 필드는 앱 버전 정보를 어디서 가져올지를 설정합니다. local은 로컬에서 버전 정보를 사용하고, remote는 원격에서 가져옵니다. 실제 앱에서 사용되는 버전 정보를 지정할 때 해당 값을 설정합니다.
    • 예: local 또는 remote

 

5. metro.config.js 수정하기

const { getDefaultConfig } = require("@expo/metro-config");

const defaultConfig = getDefaultConfig(__dirname);
const { assetExts, sourceExts } = defaultConfig.resolver;

/**
 * Metro configuration
 * https://facebook.github.io/metro/docs/configuration
 *
 * @type {import('metro-config').MetroConfig}
 */
const config = {
  transformer: {
    babelTransformerPath: require.resolve("react-native-svg-transformer"),
    unstable_allowRequireContext: true,
  },
  resolver: {
    assetExts: defaultConfig.resolver.assetExts.filter((ext) => ext !== "svg"), // svg 파일을 제외
    sourceExts: [...sourceExts, "svg"], // svg 파일을 소스 확장자에 추가
  },
};

// Expo의 기본 설정을 확장하는 방식으로 병합하지 않고 바로 export
module.exports = defaultConfig;

 

 

  • getDefaultConfig(__dirname): Expo 기본 설정을 가져옵니다.
  • babelTransformerPath: .svg 파일을 처리할 수 있도록 react-native-svg-transformer를 사용합니다.
  • assetExts와 sourceExts: .svg 파일을 자산 파일에서 제외하고, 소스 확장자에 추가하여 .svg 파일을 소스 코드로 인식하게 합니다.

* 파일 수정하고 npm install -g eas-cli 명령어로 최신화 제대로 됐는지 확인하기

6. 인증키는 안드로이는 자동 생성, ios는 회사에서 갖고 있는거 있어서 그대로 사용함

 


 

간단한 자바스크립트 수정 시에는 eas update하면 되고,

정적 파일이나 native 내부 자체 소스 코드가 변경이 되는 경우에는 eas build로 재배포를 해주어야 한다!

재배포할 때에는 버전 코드 업데이트 같이 해주어야 함 

반응형