我试图在我的react原生应用程序中添加ES2020功能,我安装了"babel-preset-es2020": "^1.0.2"
并添加了.babelrc
文件,如下所示:
{
"presets": ["es2020"]
}
但似乎什么都不起作用,这个错误正在出现:
error: Error: Unable to resolve module `./animations/TimingAnimation` from `node_modulesreact-native-reanimatedsrcAnimated.js`:
None of these files exist:
* node_modulesreact-native-reanimatedsrcanimationsTimingAnimation(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
* node_modulesreact-native-reanimatedsrcanimationsTimingAnimationindex(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
at ModuleResolver.resolveDependency (C:Userssmonddevsg_appnode_modulesmetrosrcnode-hasteDependencyGraphModuleResolution.js:163:15)
at ResolutionRequest.resolveDependency (C:Userssmonddevsg_appnode_modulesmetrosrcnode-hasteDependencyGraphResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (C:Userssmonddevsg_appnode_modulesmetrosrcnode-hasteDependencyGraph.js:287:16)
at Object.resolve (C:Userssmonddevsg_appnode_modulesmetrosrclibtransformHelpers.js:267:42)
at C:Userssmonddevsg_appnode_modulesmetrosrcDeltaBundlertraverseDependencies.js:434:31
at Array.map (<anonymous>)
at resolveDependencies (C:Userssmonddevsg_appnode_modulesmetrosrcDeltaBundlertraverseDependencies.js:431:18)
at C:Userssmonddevsg_appnode_modulesmetrosrcDeltaBundlertraverseDependencies.js:275:33
at Generator.next (<anonymous>)
at asyncGeneratorStep (C:Userssmonddevsg_appnode_modulesmetrosrcDeltaBundlertraverseDependencies.js:87:24)
请告诉我一种在那里启用ES2020 的方法
您的错误似乎与react本机重新激活包有关,而不是ES版本。确保react native reanimated已安装在您的软件包.json中,否则:
npm i react-native-reanimated