Starter template for build Ionic/Angular/Cordova apps with Typeorm.
- Download the installer for Node.js 10 or greater.
- Install the ionic CLI globally:
npm install -g ionic - Clone this repository:
git clone https://github.com/coturiv/ionic-typeorm-starter. - Run
npm installfrom the project root. - Run
ionic servein a terminal from the project root.
-
Install dependencies
npm i typerom ionic cordova plugin add cordova-plugin-sqliteBelow steps are required to use
Sql.jsin the web platform.npm i sql.jsAnd install
@angular-builders/custom-webpack, is needed for apply custom webpack confignpm i -D @angular-builders/custom-webpack -
Project configuration
-
Correct
typeormpath./tsconfig.app.json"types": ["node"], "paths": { "typeorm": [node_modules/typeorm/browser"] } -
[SQL.js] Customize Webpack
./angular.jsonCreate webpack in the config(or something else you prefer) and update
angular.json.Note:
webpack.asm.jsis designed to use asm.js andwebpack.wasm.jsis designed to use WebAssembly, butwebpack.wasm.jsdoes't support dev environment now.Before:
"build": { "builder": "@angular-devkit/build-angular:browser", "options": { ... "serve": { "builder": "@angular-devkit/build-angular:dev-server",After:
"build": { "builder": "@angular-builders/custom-webpack:browser", "options": { "customWebpackConfig": { "path": "./config/webpack.asm.js" }, ... "serve": { "builder": "@angular-builders/custom-webpack:dev-server",WebAssembly in the production:
"configurations": { "production": { "customWebpackConfig": { "path": "./config/webpack.wasm.js" }, -
[SQL.js] Add some definitions to work
typeormin the browser./src/polyfills.ts(window.global as any) = window; // global.Buffer is requred global.Buffer = global.Buffer || require('buffer').Buffer; // NodeJS.process is requred (window as any).process = { env: { DEBUG: undefined }, browser: true };
-
-
[Optional] Remove
react-ative warnings:use
patchscript in thescriptsdirectory -
Build
ionic cordova platform build --prod ['ios' | 'android' | 'browser']





