typeorm / react-native-example

Example project to demonstrate TypeORM with React Native.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Database operations are not working when i run in release mode :(

wliadmin opened this issue · comments

Database operations are not working in release mode

Steps to reproduce

-> Run this demo by archiving application in iOS
-> Database operations are not performing in release mode

Expected behaviour

-> All the database operations should be performed

commented

@wliadmin where you able to find a solution for this issue?

commented

I cannot get https://github.com/typeorm/react-native-example/ to run on either Android or iOS with or without metro-minify-terser

Try https://github.com/sheva007/typeorm-boilerplate/

This runs on iOS debug/release and Android in simulator in debug mode. On iOS I wen to select "Legacy Build" from Xcode > File > Project Settings

I cannot get an Android release build to run?

Perhaps an issue with signing setup?

react-native run-android --variant=release
info JS server already running.
info Building and installing the app on the device (cd android && ./gradlew app:installRelease)...

FAILURE: Build failed with an exception.

* What went wrong:
Task 'installRelease' not found in project ':app'. Some candidates are: 'uninstallRelease'.

A debug build runs fine on Android simulator:

react-native run-android

This issue is due to minification in release mode changing class names and file names. It can be fixed with the following steps:

  1. yarn add metro-minify-terser
  2. Update the metro config to keep class names and file names. Add the following to the metro.config.js transformer:
minifierPath: 'metro-minify-terser',
minifierConfig: {
    ecma: 8,
    keep_classnames: true,
    keep_fnames: true,
    module: true,
    mangle: {
        module: true,
        keep_classnames: true,
        keep_fnames: true,
    },
 },
commented

This issue is due to minification in release mode changing class names and file names. It can be fixed with the following steps:

  1. yarn add metro-minify-terser
  2. Update the metro config to keep class names and file names. Add the following to the metro.config.js transformer:
minifierPath: 'metro-minify-terser',
minifierConfig: {
    ecma: 8,
    keep_classnames: true,
    keep_fnames: true,
    module: true,
    mangle: {
        module: true,
        keep_classnames: true,
        keep_fnames: true,
    },
 },

thank you!
It's very useful to me

This issue is due to minification in release mode changing class names and file names. It can be fixed with the following steps:

  1. yarn add metro-minify-terser
  2. Update the metro config to keep class names and file names. Add the following to the metro.config.js transformer:
minifierPath: 'metro-minify-terser',
minifierConfig: {
    ecma: 8,
    keep_classnames: true,
    keep_fnames: true,
    module: true,
    mangle: {
        module: true,
        keep_classnames: true,
        keep_fnames: true,
    },
 },

I tried this solution but the problem has not been solved yet
can you help me pls?

Changing the minifier config didn't work for me (react native version 0.67). However, I was able to get it working in release builds by explicitly setting table names in the entity decorator:

@Entity({ name: "my_table_name" })
class MyTableName {

...