You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+57-8Lines changed: 57 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,11 +5,15 @@ This project demonstrates how that would work.
5
5
## TypeORM >= 0.1.7
6
6
To support webpack builds outside of Ionic we had to remove the automatic selection of the correct TypeORM version (the `typeorm` package comes with a Node and a browser version). In order to keep using TypeORM with Ionic you have to create a custom `webpack.config.js` file. This example contains one that is identical to the one Ionic uses when no config file is specified but adds the `NormalModuleReplacementPlugin` to select the correct version.
7
7
If you already have a custom webpack config file you have to add these lines to your plugins (for both development and production):
8
+
8
9
```js
9
10
plugins: [
10
11
...,
11
12
newwebpack.NormalModuleReplacementPlugin(/typeorm$/, function (result) {
4. Run the app: `ionic cordova run <ios | android>`. If you need help, you can read [ionic's guide](https://ionicframework.com/docs/intro/deploying/) for running an app on your device
27
+
## Installation
28
+
29
+
To run this example in production or development mode you have to make sure, `ionic` and `cordova` are installed globally on your machine. After that you can install all necessary dependencies for running this example.
30
+
31
+
0. Check if `npm` is installed. Otherwise please [install `node.js` and `npm`](https://nodejs.org/en/download/package-manager/).
32
+
```bash
33
+
npm -v
34
+
```
35
+
36
+
1. Install ionic and cordova command line interface globally.
37
+
```bash
38
+
npm install -g cordova ionic
39
+
```
40
+
41
+
2. Install all dependencies listed in [`package.json`](/package.json#L15-L47).
42
+
```bash
43
+
npm install
44
+
```
45
+
46
+
### Run app in development mode
47
+
3. Run the app in your browser:
48
+
```bash
49
+
ionic serve
50
+
```
51
+
52
+
### Run app in production mode
53
+
3. Add an iOS or Android platform to your project:
54
+
```bash
55
+
ionic cordova platform add ios
56
+
# or
57
+
ionic cordova platform add android
58
+
```
59
+
60
+
4. Run the app on your device:
61
+
```bash
62
+
ionic cordova run ios
63
+
# or
64
+
ionic cordova run android
65
+
```
66
+
67
+
*For further information please read [ionic's deployment guide](https://ionicframework.com/docs/intro/deploying/).*
68
+
28
69
29
70

30
71
31
72
### Using TypeORM in your own app
32
73
1. Install the plugin: `ionic cordova plugin add cordova-sqlite-storage --save`
4. Add `"typeRoots": ["node_modules/@types"]` to your `tsconfig.json` under `compilerOptions`
80
+
36
81
5. Create a custom webpack config file like the one [included in this project](config/webpack.config.js) to use the correct TypeORM version and add the config file to your [`package.json`](package.json#L12-14) (Required with TypeORM >= 0.1.7)
37
82
38
83
### Limitations to TypeORM when using production builds
39
-
Since Ionic make a lot of optimizations when building for productions, the following limitations occur
84
+
85
+
Since Ionic make a lot of optimizations while building for production, the following limitations will occur:
86
+
40
87
1. Entities have to be marked with the table name (eg `@Entity('table_name')`)
41
-
2.`getRepository()` has to be called with the name of the entity instead of the class (eg `getRepository('post') as Repository<Post>`)
42
-
2. Date fields aren't supported
88
+
89
+
2.`getRepository()` has to be called with the name of the entity instead of the class (*eg `getRepository('post') as Repository<Post>`*)
0 commit comments