proyecto26 / ion-phaser

A web component to use Phaser Framework with Angular, React, Vue, etc 🎮
https://market.ionicframework.com/plugins/ionphaser
MIT License
251 stars 39 forks source link

Cannot find type definition file for 'phaser' #20

Closed tljesse closed 3 years ago

tljesse commented 4 years ago

Environment Angular 9.1.0 Ionic 5.1.0 Typescript 3.7.5

Error Message

[ng] ERROR in node_modules/@ion-phaser/core/dist/types/components/models/index.d.ts:1:23 - error TS2688: Cannot find type definition file for 'phaser'.
[ng] 1 /// <reference types="Phaser" />

I'm getting this error when trying to run ionic serve and I haven't found a solution. I have the file phaser.d.ts in the src folder and have tried to add that directly to tsconfig.json files list without success.

When I remove the line /// <reference types="Phaser" /> from the index.d.ts file in @ion-phaser then it will run but this can't be the solution. Any help is greatly appreciated!

jdnichollsc commented 4 years ago

Do you have this configuration? https://github.com/proyecto26/ion-phaser/blob/master/demo-angular/tsconfig.json#L24

tljesse commented 4 years ago

This is my tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "esnext",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom", 
      "scripthost"
    ],
    "paths": {
      "@app/*": [
        "src/app/*"
      ],
      "@assets/*": [
        "src/assets/*"
      ],
      "@env/*": [
        "src/environments/*"
      ]
    }
  },
  "files": ["src/phaser.d.ts"],
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}

We have the phaser.d.ts file in the src folder. Before we had been using phaser on it's own without ion-phaser and had some issues getting it running and ended up having to remove phaser.d.ts from the phaser folder in node_modules. I'm trying to convert everything over now so the project also won't run if I leave phaser.d.ts in node_modules since I haven't converted everything.

This probably sounds like a weird configuration, maybe I need to get rid of the old phaser games as I rebuild and put that back into node_modules? But shouldn't adding that to files from any destination still work?

jdnichollsc commented 3 years ago

@tljesse can you attach a repo to be able to reproduce this issue?

jdnichollsc commented 3 years ago

Please let me know if the issue persist with the last version, thanks!