typeorm / ionic-example

Example project to demonstrate TypeORM in an Ionic app
67 stars 56 forks source link

Ionic run build --prod give Repository not found error #16

Open pcfjojo opened 6 years ago

pcfjojo commented 6 years ago

In developement and Prod android version works fine. But when I tried with the browser. I get the error. I follow the [https://github.com/typeorm/ionic-example]

Any help?

here is my config file.

import { Expense } from './../entities/expense';
import { Medicine } from './../entities/medicine';
import { Client } from './../entities/client';
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { createConnection } from 'typeorm'
import { Company } from '../entities/company';
import { Order } from '../entities/order';
import { OrderDetail } from '../entities/orderDetail';

@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  rootPage: string = "LoginPage";

  constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
    platform.ready().then(async () => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      statusBar.styleDefault();
      splashScreen.hide();

      // Depending on the machine the app is running on, configure
      // different database connections
      if(platform.is('cordova')) {
        // Running on device or emulator
        await createConnection({
          type: 'cordova',
          database: 'test',
          location: 'default',
          synchronize: true,
          logging: ['error', 'query', 'schema'],
          entities: [
            Client,Medicine,Company, Order, OrderDetail, Expense
          ]
        });
      } else {
        // Running app in browser
        await createConnection({
          type: 'sqljs',
          autoSave: true,
          location: 'browser',
          synchronize: true,
          logging: ['error', 'query', 'schema'],
          entities: [
            Client, Medicine, Company, Order, OrderDetail, Expense
          ]
        });
      }
    });
  }
}
daniel-lang commented 6 years ago

If your app runs on a device in development and production mode, it should also work in the browser in both modes. Can you provide a small repository for me to take a look at it?

pcfjojo commented 6 years ago

@daniel-lang I have create a repo please check it out https://github.com/pcfjojo/Easymedi