在我的项目中,我们使用
react-native-azure-ad
插件。问题是,npm上的这个插件已经过时,并且使用了一种不推荐的访问webview的方式,这种方式已经从react native中提取出来,用于react natives webview。
当我浏览
github page
观察那里的源代码,看起来github上的代码已经更新为使用react-native webview,这让我相信作者没有更新npm包以遵循github版本。
只有一种方法可以解决这个问题,那就是直接从github下载模块并手动导入。问题是,我只知道如何通过npm安装导入模块。
目前,这是基本的文件夹结构:
Root
- node_modules
- src --> the app source code
我想这样放置模块:
Root
- node_modules
- node_updates
- react-native-azure-ad
- src
我仍然希望能够像这样导入它:
import {ReactNativeAD, ADLoginView} from 'react-native-azure-ad'
当然,我会从package.json中删除react-native azure广告,并提前重新安装node_modules。
这可能吗?
我希望我不必依赖相对路径,比如:
import {ReactNativeAD, ADLoginView} from '../../../node_updates/react-native-azure-ad'
我看到了一些答案,比如
this
,但这要求我使用相对路径进行导入。