我知道在命令中您可以使用该标志react-native bundle
将您的应用程序与指定的条目文件捆绑在一起。--entry-file
是否有类似的标志或解决方法react-native run-ios
或react-native run-android
命令,您可以在其中指定条目文件?
问问题
899 次
1 回答
0
react-native run-android --help
揭示了一些选项,但没有指定入口点。但是在android/app/build.gradle
你会发现:
project.ext.react = [
bundleAssetName: "index.android.bundle",
entryFile: "index.android.js",
bundleInRelease: true,
jsBundleDirRelease: "$buildDir/intermediates/assets/release",
resourcesDirRelease: "$buildDir/intermediates/res/merged/release"
]
然后,您可以在 gradle 构建中创建不同的变体
buildTypes {
customVariant {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
debuggable false
jniDebuggable false
renderscriptDebuggable false
zipAlignEnabled true
project.ext.react.entryFile "custom.android.js"
}
}
然后就可以做react-native run-android --variant=customVariant
于 2017-03-21T07:41:00.663 回答