angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

Set up instructions break Material 2 setup

Open cmermingas opened this issue 10 years ago • 2 comments

I am not sure if this would be an issue with the Material 2 module or angularfire2... Or most likely user error.

I set up a project with angular cli, then followed the material 2 set up. It worked fine. Then I followed the angularfire2 setup instructions through the end. The very last step (temporary workaround) fixes the cannot find name 'require' error but makes these ones show up:

ERROR in [default] /Users/cmermingas/web_projects/myapp/node_modules/@angular/material/core/gestures/MdGestureConfig.d.ts:4:39 
Cannot find name 'HammerManager'.

ERROR in [default] /Users/cmermingas/web_projects/myapp/node_modules/@angular/material/slide-toggle/slide-toggle.d.ts:68:19 
Cannot find name 'HammerInput'.

ERROR in [default] /Users/cmermingas/web_projects/myapp/node_modules/@angular/material/slider/slider.d.ts:61:19 
Cannot find name 'HammerInput'.

ERROR in [default] /Users/cmermingas/web_projects/myapp/node_modules/@angular/material/slider/slider.d.ts:63:24 
Cannot find name 'HammerInput'.

I've tried many workarounds, except those that ask to modify files under node_modules, with no luck.

It would be great to have set up instructions that take this into account. Thanks in advance!

My files look like this:

typings.d.ts

// Typings reference file, see links for more information
// https://github.com/typings/typings
// https://www.typescriptlang.org/docs/handbook/writing-declaration-files.html

declare var System: any;

// Angularfire2 workaround ast described in
// https://github.com/angular/angularfire2/blob/master/docs/1-install-and-setup.md

declare var require: any;
declare var module: any;

tsconfig.json

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

Versions:

angular-cli: 1.0.0-beta.17 node: 4.4.2 os: darwin x64 firebase"^3.4.1" angularfire2: "^2.0.0-beta.5"

cmermingas avatar Oct 14 '16 17:10 cmermingas

Try adding hammerjs to tsconfig.json types - "types":[ "hammerjs" ]

kkotak avatar Oct 14 '16 18:10 kkotak

@kkotak - Thank you! That worked perfectly and I think I understand why, based on this documentation.

cmermingas avatar Oct 16 '16 15:10 cmermingas