我正在开发一个带有TypeScript模板的Bare React Native音频播放器混合(Web 和 android)应用程序。在我实现了expo-av并尝试在网络上编译它之后,我得到了这个:
Failed to compile.
./node_modules/expo-av/build/Audio/Recording.js 134:46
Module parse failed: Unexpected token (134:46)
File was processed with these loaders:
* ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| this._canRecord = false;
| this._isDoneRecording = true;
> this._finalDurationMillis = finalStatus?.durationMillis ?? 0;
| _recorderExists = false;
|
webpack.config.js:
const createExpoWebpackConfigAsync = require('@expo/webpack-config');
module.exports = async function(env, argv) {
const config = await createExpoWebpackConfigAsync({
...env,
babel: {
dangerouslyAddModulePathsToTranspile: ['@ui-kitten/components']
}
}, argv);
return config;
};
包.json:
"dependencies": {
"react": "^16.13.1",
"react-native": "0.63.4",
...
}
"devDependencies": {
"@expo/webpack-config": "^0.12.58",
"@babel/core": "^7.8.4",
...
}
如果有帮助,这是我的存储库: https ://github.com/VelislavP/MeditationAppReactNative
使用 expo-av 的文件是:MeditationAppReactNative/src/screens/meditations.tsx
我该如何解决这个问题?提前致谢。