You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Roy Ackermann (JIRA)" <ji...@apache.org> on 2017/11/02 11:05:00 UTC

[jira] [Created] (CB-13526) Error: "Cannot find name 'device'." in a Angular 4 Project while running ng build.

Roy Ackermann created CB-13526:
----------------------------------

             Summary: Error: "Cannot find name 'device'."  in a Angular 4 Project while running ng build.
                 Key: CB-13526
                 URL: https://issues.apache.org/jira/browse/CB-13526
             Project: Apache Cordova
          Issue Type: Bug
          Components: cordova-plugin-device
         Environment: cordova-plugin-file: 4.3.3
cordova: 7.0.1
Desktop: Windows 10

            Reporter: Roy Ackermann
            Priority: Blocking


I would like to load an Angular 4 project with Cordova. For this,  I build my Amngular App with ng build and copy it into the /WWW directory of Cordova. This works so far.

Now I have installed the file plugin in the cordova project. In addition, I have installed the NPM module @types/cordova-plugin-file to the angular project, where the type definitions are inclued.

the structure: 
- cordova projekt-root
---   node_modules
---   www
---   plugins
------   cordova-file-plugin
---   ......
---   angular projekt-root
------  node_modules
---------  @types
------------  cordova-file-plugin
------  src
------  tsconfig.json
------  .....

Here are the typesRoots Part of my tsconfig.json file, wich include all index.d.ts files from the"node_modules/@types" folder.

  "typeRoots": [
      "node_modules/@types"
    ]

It works for example for jJQuery or other libraries. But not for all cordova plugins. Because, in the index.d.ts files from cordova plugins, there are no exports. There are ony declarations from variables. But not exported. 

When i run ng build, i get the error  "Cannot find name 'device'." Is there an error in the typedefinitions from the cordova plugins? 





--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org