我试图在我的 react-native 应用程序中添加 ES2020 功能,我安装"babel-preset-es2020": "^1.0.2"
并添加了.babelrc
如下文件:
{
"presets": ["es2020"]
}
但似乎没有任何效果,这个错误来了:
error: Error: Unable to resolve module `./animations/TimingAnimation` from `node_modules\react-native-reanimated\src\Animated.js`:
None of these files exist:
* node_modules\react-native-reanimated\src\animations\TimingAnimation(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
* node_modules\react-native-reanimated\src\animations\TimingAnimation\index(.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:\Users\smond\dev\sg_app\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:163:15)
at ResolutionRequest.resolveDependency (C:\Users\smond\dev\sg_app\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (C:\Users\smond\dev\sg_app\node_modules\metro\src\node-haste\DependencyGraph.js:287:16)
at Object.resolve (C:\Users\smond\dev\sg_app\node_modules\metro\src\lib\transformHelpers.js:267:42)
at C:\Users\smond\dev\sg_app\node_modules\metro\src\DeltaBundler\traverseDependencies.js:434:31
at Array.map (<anonymous>)
at resolveDependencies (C:\Users\smond\dev\sg_app\node_modules\metro\src\DeltaBundler\traverseDependencies.js:431:18)
at C:\Users\smond\dev\sg_app\node_modules\metro\src\DeltaBundler\traverseDependencies.js:275:33
at Generator.next (<anonymous>)
at asyncGeneratorStep (C:\Users\smond\dev\sg_app\node_modules\metro\src\DeltaBundler\traverseDependencies.js:87:24)
请告诉我一种在那里启用 ES2020 的方法