Skip to content

Commit 8be1b22

Browse files
committed
improved README to example changed for TypeORM 0.1.8
1 parent 4030030 commit 8be1b22

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22
You can use TypeORM in connection with the `cordova-sqlite-storage` plugin in your Ionic app.
33
This project demonstrates how that would work.
44

5+
## TypeORM >= 0.1.8
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+
If you already have a custom webpack config file you have to add these lines to your plugins (for both development and production):
8+
```js
9+
plugins: [
10+
...,
11+
new webpack.NormalModuleReplacementPlugin(/typeorm$/, function (result) {
12+
result.request = result.request.replace(/typeorm/, "typeorm/browser");
13+
})
14+
]
15+
```
16+
If you don't use a custom wepack config, copy the one from this example and add it to your `package.json` under `config`:
17+
```json
18+
"config": {
19+
"ionic_webpack": "./config/webpack.config.js"
20+
}
21+
```
22+
523
### How to run this example
624
1. Install the ionic and cordova cli: `npm install -g cordova ionic`
725
2. Install all dependencies: `npm install`

0 commit comments

Comments
 (0)