Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions android/app/src/main/java/com/jeong/naeilmorae/MainApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ class MainApplication : Application(), ReactApplication {

override val reactNativeHost: ReactNativeHost =
object : DefaultReactNativeHost(this) {
// Code Push via CDN
override fun getJSBundleFile(): String? {
return if (BuildConfig.DEBUG) {
// 디버그 모드일 때는 null 반환해서 Metro 서버 연결
null
} else {
// 릴리즈 모드일 때는 CDN 번들 사용
"https://ip-file-upload-test.s3.ap-northeast-2.amazonaws.com/naeilmorae-bundle/index.android.bundle"
}
}
Comment on lines +23 to +32
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안드로이드에서 외부 js bundle 파일을 참조하게 했습니다.


override fun getPackages(): List<ReactPackage> =
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
Expand Down
4 changes: 3 additions & 1 deletion ios/naeilmorae/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ - (NSURL *)bundleURL
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
// return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
// Code Push via CDN
return [NSURL URLWithString:@"https://ip-file-upload-test.s3.ap-northeast-2.amazonaws.com/naeilmorae-bundle/index.ios.bundle"];
Comment on lines +43 to +45
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ios 에서 외부 js bundle 파일을 참조하게 했습니다.

#endif
}

Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint --ext .tsx --ext .ts src/"
"lint": "eslint --ext .tsx --ext .ts src/",
"bundle:android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output dist/android/index.android.bundle --assets-dest dist/android/assets",
"bundle:ios": "react-native bundle --platform ios --dev false --entry-file index.js --bundle-output dist/ios/index.ios.bundle --assets-dest dist/ios/assets",
"bundle": "yarn bundle:android && yarn bundle:ios"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

추후 js 코드 변경 시 -> yarn bundle 명령어 실행 -> dist 폴더에 추출된 js bundle 파일과 assets 를 CDN 에 업로드하는 방식입니다.

},
"dependencies": {
"@amplitude/analytics-react-native": "^1.4.11",
Expand Down