[英]How to resolve module name conflict in react native
I have two module with the exact same name that belongs to two different apps, these two module are functionally quite similar except for the styling. 我有两个模块具有完全相同的名称,属于两个不同的应用程序,这两个模块在功能上非常相似,除了样式。 I am creating a master component and try to import these two different module based on what app I am currently in. 我正在创建一个主组件,并尝试根据我当前的应用程序导入这两个不同的模块。
I wonder if there is a way to conditionally import the module that I don't have to hard code a name space for the module, like module_app1
and module_app2
but instead to do 我想知道是否有办法有条件地导入模块,我没有硬编码模块的名称空间,如module_app1
和module_app2
,而是做
if (cond) {
import module from 'path1';
} else {
import module from 'path2';
}
I use 'as'. 我用'as'。 Example: 例:
import Actions from '../actions';
import { Actions as Navigator } from 'react-native-router-flux';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.