NativeScript 版本 8.2.1:如何使用旧的过时插件

NativeScript Version 8.2.1 : how to use old outdated plugins

I am new to NativeScript and Webpack and i have migrated my native script app from 6.5.1 to 8.2 version, and i am using nativescript-orientation-free plugin ,i am getting build errors as this plugin still refers to tns-core-modules which is no longer supported in Native Script 8 and i am getting below errors

./node_modules/nativescript-orientation-free/orientation.js 中的错误 17:12-48 找不到模块:错误:无法解析“/Users/admin/Development/project/node_modules/nativescript-orientation-free”

中的 'tns-core-modules/ui/enums'

./node_modules/nativescript-orientation-free/orientation.js 中的错误 18:12-48 找不到模块:错误:无法解析“/Users/admin/Development/project/node_modules/nativescript-orientation-free”

中的 'tns-core-modules/ui/frame'

我们不想使用这个付费版本pro-plugins-nativescript-orientation

你能告诉我如何解决这个问题吗? webpack.config.js 有什么我可以做的吗?我卡在这里了。

我很同情你。 (电影《异形》中的一句话。)

将 NativeScript 应用程序从 6.5 迁移到 8.x 由于所有重大更改,可能会非常令人沮丧。请务必观看此视频:Migrating Legacy NativeScript 6 Project to 8.

在迁移我的应用程序时,我发现我必须迁移我使用的几个插件。 Patch-package是你的朋友!要回答您的问题,您需要修改圈出的链接。有时这很容易,有时这需要调查。

这三个应该有效:

import { Application as application } from '@nativescript/core';
const Enums = require("@nativescript/core/core-types").Enums;
import { Frame as frame } from '@nativescript/core';

我希望这两个应该有用,'虽然我没有在我的项目中使用它们:

import { Page } from '@nativescript/core';
import { View as view } from '@nativescript/core';

祝你好运!

我删除了这个插件并且能够在没有任何第三方插件的情况下使用

设置方向

UIDevice.currentDevice.setValueForKey(1, "orientation");