【问题标题】:TypeOrm + Sqlite works only in development [React Native + Expo]TypeOrm + Sqlite 仅在开发中有效 [React Native + Expo]
【发布时间】:2021-09-04 14:29:17
【问题描述】:

在开发过程中,应用程序数据库运行良好,但是当我生成 APK 时,它无法正常工作,我无法使用该数据库。

【问题讨论】:

    标签: react-native sqlite expo typeorm


    【解决方案1】:

    我发现了jbenzshawel的这个答案:

    1º:yarn add metro-minify-terser

    2º:更新 Metro 配置以保留类名和文件名。将以下内容添加到 metro.config.js 转换器中:

    minifierConfig: {
        ecma: 8,
        keep_classnames: true,
        keep_fnames: true,
        module: true,
        mangle: {
            module: true,
            keep_classnames: true,
            keep_fnames: true,
        },
     },
    

    因此,如果您需要创建metro.config.js,请添加以下内容:

    const { getDefaultConfig } = require('expo/metro-config');
    
    const config = getDefaultConfig(__dirname);
    
    config.transformer.minifierPath = 'metro-minify-terser';
    config.transformer.minifierConfig = {
        ecma: 8,
        keep_classnames: true,
        keep_fnames: true,
        module: true,
        mangle: {
            module: true,
            keep_classnames: true,
            keep_fnames: true,
        },
    };
    
    module.exports = config;
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-20
      • 2017-10-16
      • 1970-01-01
      • 2018-12-15
      • 2020-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多