Cannot find module 'application'

nativescriptcore
plugins

#1

In my plugin file: plugin-name.android.ts I have imported application module as following:

import * as application from "application";

But I get the mentioned error.

Note: The plugin worked fine after refreshing. But in the next runs, it stopped with tthat error.
Any idea?


#2

Guess you are using plugin seed, did you install the dependencies - npm install?


#3

I changed

import * as application from "application";

with

import * as application from "tns-core-modules/application";

And now it works fine. I think Nativescript team have forgotten to change the docs.


#4

Nothing has changed, it was always * as from "tns-core-modules/application", but when you create a project from CLI with any of the default template, it adds few lines in tsconfig which allows you to import that as * as from "application"


#5

But my tsconfig.json doesn’t include it.


#6

… it adds few lines in tsconfig which allows you to import that as * as from “application”

Actually new version of cli doesn’t do this. It uses * as from "tns-core-modules/application" but official docs uses * as from "application".