cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jcesarmobile (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (CB-13526) Error: "Cannot find name 'device'." in a Angular 4 Project while running ng build.
Date Fri, 23 Nov 2018 13:39:00 GMT

     [ https://issues.apache.org/jira/browse/CB-13526?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

jcesarmobile closed CB-13526.
-----------------------------
    Resolution: Invalid

The cordova plugins have definitions included, you don't have to include @types/cordova-plugin-file

To use plugin types you have to add this on top of the file where you are going to use it
like this:
{code}
/// <reference types="cordova-plugin-file" />
{code}

Not sure how this issue relates to device as you are using file plugin.

Going to close as you are not using the official types and the problem might be because of
that, if you still face the issue when using the official types, please report a new issue
on file or device repo providing more information

> 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: Blocker
>
> 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
(v7.6.3#76005)

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


Mime
View raw message