【发布时间】:2019-07-27 06:22:40
【问题描述】:
我的 aws-react-native 应用程序在 Android 上完美运行(使用 expo),但是当我尝试在 expo 中使用“w”选项然后在浏览器中运行它时,我收到以下错误页面。在我看来,缺少一些库或类似的东西,有谁知道我可以尝试使其在网络上可用吗?
在 Android 上测试并且运行良好 - 问题似乎只发生在浏览器中,并且似乎与 aws-amplify 相关。
我的 App.js 导入:
import * as Localization from 'expo-localization';
import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';
// Necessary for "Auth" service
import Auth from '@aws-amplify/auth';
import Analytics from '@aws-amplify/analytics';
import { Authenticator } from 'aws-amplify-react-native';
import awsconf from './source/aws-exports';
Auth.configure(awsconf);
Analytics.configure(awsconf);
//Necessary for Translation
console.log(Localization.locale);
import { I18n } from 'aws-amplify';
import dict from './source/translations';
I18n.setLanguage(Localization.locale);
I18n.putVocabularies(dict);
...
错误页面:
×
ReferenceError: dict is not defined
Module.../../../../../../../../../../../environment/node_modules/aws-
amplify-react-native/dist/AmplifyI18n.js
node_modules/aws-amplify-react-native/dist/AmplifyI18n.js:14
11 | * and limitations under the License.
12 | */
13 |
> 14 | export default dict = {
15 | 'fr': {
16 | 'Loading...': "S'il vous plaît, attendez",
17 | 'Sign In': "Se connecter",
View compiled
__webpack_require__
/home/ubuntu/environment/webpack/bootstrap:724
721 | };
722 |
723 | // Execute the module function
> 724 | modules[moduleId].call(module.exports, module, module.exports,
hotCreateRequire(moduleId));
| ^ 725 |
726 | // Flag the module as loaded
727 | module.l = true;
View compiled
fn
/home/ubuntu/environment/webpack/bootstrap:101
98 | );
99 | hotCurrentParents = [];
100 | }
> 101 | return __webpack_require__(request);
| ^ 102 | };
【问题讨论】:
标签: javascript node.js amazon-web-services react-native