ionic-example icon indicating copy to clipboard operation
ionic-example copied to clipboard

Ionic 4/Angular 6 compatibility?

Open jameskane05 opened this issue 6 years ago • 19 comments

While considering TypeORM for a new production project, I was able to get the example app running no problem. Works as expected, looks great.

Now trying to configure it w/ my project environment and I've thrown a lot of time away. I'm using the new Ionic 4 beta 12 along with Angular 6. I'm getting the same issues referenced here re: @types/node and some settings in tsconfig.json files:

https://github.com/typeorm/typeorm/issues/900

But the suggested fixes don't work (see my latest comment on that thread). Any idea if TypeORM can or will support Ionic 4 + Angular 6? I can post more info if requested - not sure if anyone's monitoring issues here. Cheers & thanks.

jameskane05 avatar Oct 03 '18 21:10 jameskane05

I haven't had the time yet to what needs to be done to support Ionic 4. Our end goal is to support Ionic 4 but I can't tell you how soon it will be done.

daniel-lang avatar Oct 06 '18 06:10 daniel-lang

is there any advance about this issue? please @daniel-lang

nextbyn avatar Oct 30 '18 19:10 nextbyn

I've started a new project and I'm stuck on this issue to Ionic 4/Angular 6 , so I I'v have to ask ..When you think spec this issue is solved?

exequielc avatar Nov 02 '18 11:11 exequielc

I'm using Ionic 7/Angular 6 and was able to get it working by adding "types": ["node"] to src/tsconfig.app.json, not the tsconfig.json in the root directory.

Edit I was wrong. Once I actually started using it I just got different errors.

MarkRabey avatar Dec 07 '18 16:12 MarkRabey

I'm using Ionic 7/Angular 6 and was able to get it working by adding "types": ["node"] to src/tsconfig.app.json, not the tsconfig.json in the root directory.

Edit I was wrong. Once I actually started using it I just got different errors.

Can You post your tsconfig.app.json and package.json so I can compare with mine

nextbyn avatar Dec 10 '18 11:12 nextbyn

@nextbyn sorry, I reverted back to try to find another solution. Like I said, it actually didn't work anyway.

MarkRabey avatar Dec 10 '18 16:12 MarkRabey

@nextbyn sorry, I reverted back to try to find another solution. Like I said, it actually didn't work anyway.

It's a shame, I'm still waiting for a solution to this issue or a workaround

nextbyn avatar Dec 11 '18 16:12 nextbyn

@nextbyn sorry, I reverted back to try to find another solution. Like I said, it actually didn't work anyway.

It's a shame, I'm still waiting for a solution to this issue or a workaround

Me too :(

MarkRabey avatar Dec 11 '18 18:12 MarkRabey

Based on this discussion: https://github.com/typeorm/typeorm/issues/857, I was able to get TypeORM to work in my Ionic project by adding the following lines to src/tsconfig.app.json:

"types": ["node"],
"paths": {
  "typeorm": ["node_modules/typeorm/browser"]
}

Using:

  • Ionic 4.0.0-beta.19
  • Angular 7.1.3
  • TypeORM 0.2.9

Hope this helps!

amorgulis avatar Dec 18 '18 19:12 amorgulis

Based on this discussion: typeorm/typeorm#857, I was able to get TypeORM to work in my Ionic project by adding the following lines to src/tsconfig.app.json:

"types": ["node"],
"paths": {
  "typeorm": ["node_modules/typeorm/browser"]
}

Using:

  • Ionic 4.0.0-beta.19
  • Angular 7.1.3
  • TypeORM 0.2.9

Hope this helps! @amorgulis can you put your ts config complete and the package.json to compare

nextbyn avatar Dec 19 '18 11:12 nextbyn

@amorgulis

added "baseUrl": ".", inside "compilerOptions" tree and the build --prod finish OK.

And now when run my project (index.html) habe this error in console window.

vendor.js:1 Uncaught Error: Cannot find module "." at vendor.js:1 at vendor.js:1 at Object.<anonymous> (vendor.js:1) at e (vendor.js:1) at Object.<anonymous> (main.js:1) at e (vendor.js:1) at Object.<anonymous> (main.js:1) at e (vendor.js:1) at window.webpackJsonp (vendor.js:1) at main.js:1

nextbyn avatar Dec 19 '18 12:12 nextbyn

@nextbyn

package.json is default from a new Ionic project, except for the specific dependencies for my project. Here are the tsconfig.json and tsconfig.app.json, which are also default except for the two settings I mentioned above that went into tsconfig.app.json (notice the .app).

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  }
}

tsconfig.app.json

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "types": ["node"],
    "paths": {
      "typeorm": ["node_modules/typeorm/browser"]
    }
  },
  "exclude": ["test.ts", "**/*.spec.ts"]
}

amorgulis avatar Dec 19 '18 14:12 amorgulis

@amorgulis is it working with ionic 4 @pmathulan Sorry ,can you share a sample project to check and compare with mine. I can't make it my project work. Thanks in advance

exequielc avatar Jan 04 '19 11:01 exequielc

Just found a good sample here🥇(https://github.com/coturiv/ionic4-typeorm-starter).

ghost avatar Jan 29 '19 14:01 ghost

I was able to get work following this instruction

@nextbyn

package.json is default from a new Ionic project, except for the specific dependencies for my project. Here are the tsconfig.json and tsconfig.app.json, which are also default except for the two settings I mentioned above that went into tsconfig.app.json (notice the .app).

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  }
}

tsconfig.app.json

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "types": ["node"],
    "paths": {
      "typeorm": ["node_modules/typeorm/browser"]
    }
  },
  "exclude": ["test.ts", "**/*.spec.ts"]
}

But I had to install @angular-builders/custom-webpack and @angular-builders/dev-server

npm i @angular-builders/custom-webpack
npm i @angular-builders/dev-server

and I modifed angular.json to use angular-builders/custom-webpack:browser instead of @angular-devkit/build-angular:browser including the webpack.config.js and I modified also to use @angular-builders/dev-server:generic instead of @angular-devkit/build-angular:dev-server as follow

"builder": "@angular-builders/custom-webpack:browser",
          "options": {
                   "customWebpackConfig": {
                          "path": "./config/webpack.config.js"
                     },
...
"serve": {
          "builder": "@angular-builders/dev-server:generic",
...

glaucogoca avatar Jan 30 '19 11:01 glaucogoca

@glaucogoca this works fine for testing on the browser, but when I run it on the mobile I get an error:

ERROR Error: Uncaught (in promise): ConnectionNotFoundError: Connection "default" was not found.
ConnectionNotFoundError: Connection "default" was not found.

Any idea what I'm missing ?

gnesher avatar Apr 17 '19 12:04 gnesher

@gnesher Have you solved your problem? Perhaps you have to look your package.json file. Maybe it's missing some dependencies. Could you share it?

glaucogoca avatar Apr 23 '19 18:04 glaucogoca

I want to know if anyone already has fixed this issue too. Thanks for your help

exequielc avatar Apr 23 '19 18:04 exequielc

t found a good sample here🥇(https://github.com/coturiv/ionic4-typeorm-starter).

This is a good example to compare. I compared my code with this one and checked the differences, maybe you can do the same

glaucogoca avatar Apr 23 '19 19:04 glaucogoca