无法在 nativescript vue 中导入 @nota/nativescript-webview-ext/vue

can't import @nota/nativescript-webview-ext/vue in nativescript vue

我尝试在我的 nativescript vue 应用程序中导入 Nota NativeScript Webview Ext(参见 https://market.nativescript.org/plugins/@nota%2Fnativescript-webview-ext

我在 playground web 应用程序中添加了 npm 包,没有任何错误或问题。

我的 app.js 文件中使用了以下代码:

import Vue from 'nativescript-vue';
import App from './components/App';

import '@nota/nativescript-webview-ext/vue';

Vue.config.silent = false;

new Vue({
    render: h => h('frame', [h(App)])
}).$start();

但不幸的是我得到了以下错误

2019-06-11 15:55:30.942 nsplaydev[15435:3295521] PlayLiveSync: Uncaught Exception
2019-06-11 15:55:30.942 nsplaydev[15435:3295521] *** JavaScript call stack:
(

)
2019-06-11 15:55:30.942 nsplaydev[15435:3295521] *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Error: Could not find module '@nota/nativescript-webview-ext/vue'. Computed path '/var/mobile/Containers/Data/Application/F4AE564B-FAFA-4128-BC98-F087145C5FF1/Documents/Playground/LiveSync/app/tns_modules/@nota/nativescript-webview-ext/vue'.
at 
1 require@file:///app/app.js:11:8
2 anonymous@file:///app/app.js:11:8
3 evaluate@[native code]
4 moduleEvaluation@[native code]
5 promiseReactionJob@[native code]
', reason: '(null)'
*** First throw call stack:
(0x1ba9623a8 0x1b9b67d00 0x10499f7f4 0x1049dda00 0x1059433c8 0x10429b3f0 0x1ba3a8fd8)
libc++abi.dylib: terminating with uncaught exception of type NSException
2019-06-11 15:55:30.942 nsplaydev[15435:3295521] PlayLiveSync: Uncaught Exception

Playground 不支持所有插件,只支持没有原生依赖的插件。

nativescript-webview-ext 对 iOS 和 Android 具有原生依赖性,因此它可能无法在 Playground/Preview 应用程序上按预期工作。

仅供参考: 即使您使用没有原生依赖的插件,而 运行 Playground / Preview 应用程序,您应该使用相对路径从插件导入任何内容。