diff --git a/lib/services/livesync/playground/preview-app-plugins-service.ts b/lib/services/livesync/playground/preview-app-plugins-service.ts index 3759bb2b90..2b58ec468d 100644 --- a/lib/services/livesync/playground/preview-app-plugins-service.ts +++ b/lib/services/livesync/playground/preview-app-plugins-service.ts @@ -4,7 +4,7 @@ import * as util from "util"; import { Device } from "nativescript-preview-sdk"; import { PluginComparisonMessages } from "./preview-app-constants"; import { NODE_MODULES_DIR_NAME } from "../../../common/constants"; -import { PLATFORMS_DIR_NAME, PACKAGE_JSON_FILE_NAME, TNS_CORE_THEME_NAME, SCOPED_TNS_CORE_THEME_NAME } from "../../../constants"; +import { PLATFORMS_DIR_NAME, PACKAGE_JSON_FILE_NAME, TNS_CORE_THEME_NAME, SCOPED_TNS_CORE_THEME_NAME, LoggerConfigData } from "../../../constants"; export class PreviewAppPluginsService implements IPreviewAppPluginsService { constructor(private $errors: IErrors, @@ -40,6 +40,11 @@ export class PreviewAppPluginsService implements IPreviewAppPluginsService { public async comparePluginsOnDevice(data: IPreviewAppLiveSyncData, device: Device): Promise { const warnings = await this.getPluginsUsageWarnings(data, device); _.map(warnings, warning => this.$logger.warn(warning)); + + if (warnings && warnings.length) { + this.$logger.warn(`In the app are used one or more NativeScript plugins with native dependencies. +Those plugins will not work while building the project via \`$ tns preview\`. Please, use \`$ tns run \` command instead.`, { [LoggerConfigData.wrapMessageWithBorders]: true }); + } } public getExternalPlugins(device: Device): string[] { diff --git a/test/services/playground/preview-app-plugins-service.ts b/test/services/playground/preview-app-plugins-service.ts index a42125848d..99603944bf 100644 --- a/test/services/playground/preview-app-plugins-service.ts +++ b/test/services/playground/preview-app-plugins-service.ts @@ -42,7 +42,11 @@ function createTestInjector(localPlugins: IStringDictionary, options?: { isNativ }); injector.register("logger", { trace: () => ({}), - warn: (message: string) => warnParams.push(message) + warn: (message: string, opts: any) => { + if (!opts || !opts.wrapMessageWithBorders) { + warnParams.push(message); + } + } }); injector.register("packageInstallationManager", PackageInstallationManagerStub);