tns 预览不适用于使用 nativescript-vue 的 android

tns preview not working on android with nativescript-vue

我创建了一个超级简单的应用程序,它有 3 个选项卡和一个使用 http call/axios 生成的列表。

当我 运行 tns run android --bundle 一切正常但是当我尝试 tns preview 在我的 android phone 上使用 playground 应用程序时,我收到此错误:

Cannot compile /data/data/org.nativescript.preview/files/app/main.js

SyntaxError: Unexpected identifier
File: "file:///data/data/org.nativescript.preview/files/app/main.js, line: 1, column: 67

StackTrace: 
    Frame: function:'require', file:'', line: 1, column: 266


SyntaxError: Unexpected identifier
File: "<unknown>, line: 1, column: 265

StackTrace: 
    Frame: function:'require', file:'', line: 1, column: 266


    at com.tns.Runtime.runModule(Native Method)
    at com.tns.Runtime.runModule(Runtime.java:553)
    at com.tns.Runtime.run(Runtime.java:545)
    at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1028)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5658)
    at android.app.ActivityThread.-wrap2(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1637)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:156)
    at android.app.ActivityThread.main(ActivityThread.java:6523)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)

Executing after-watch hook from /home/badr/projects/ns/annuaire/hooks/after-watch/nativescript-dev-webpack.js
Stopping webpack watch
Executing after-watch hook from /home/badr/projects/ns/annuaire/hooks/after-watch/nativescript-dev-webpack.js
Stopping webpack watch
Executing after-watch hook from /home/badr/projects/ns/annuaire/hooks/after-watch/nativescript-dev-webpack.js
Stopping webpack watch

您缺少 tns preview 命令的 --bundle 标志。它应该与 tns preview --bundle.

一起使用

--bundle 标志负责 运行 webpack,它编译 .vue 文件。