yume-chan/ya-webadb

引入@yume-chan/adb包时,项目运行报错

liudiming opened this issue · 4 comments

Issue Checklist

  • I'm using the library programmatically
  • For Scrcpy related issues, I have searched in Genymobile/scrcpy repository.

Library version

0.0.19

Runtime

Chrome 105

Device

oppo PHQ110 Android 13

Describe the bug

我项目是vue2项目,想引入@yume-chan/adb这个做一些事情,但是运行项目的时候会报错,以下是报错信息

error in ./node_modules/@yume-chan/struct/esm/basic/field-value.js

Module parse failed: Unexpected token (9:14)
You may need an appropriate loader to handle this file type, currently
no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| export class StructFieldValue {
| /** Gets the definition associated with this runtime value */

definition;

| /** Gets the options of the associated Struct */
| options;

@ ./node_modules/@yume-chan/struct/esm/basic/index.js 2:0-33 2:0-33
@ ./node_modules/@yume-chan/struct/esm/index.js
@ ./node_modules/@yume-chan/adb/esm/packet.js
@ ./node_modules/@yume-chan/adb/esm/index.js
@ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib??ref--13-1!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/HelloWorld.vue?vue&type=script&lang=js&
@ ./src/components/HelloWorld.vue?vue&type=script&lang=js&
@ ./src/components/HelloWorld.vue
@ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib??ref--13-1!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=script&lang=js&
@ ./src/App.vue?vue&type=script&lang=js&
@ ./src/App.vue
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://10.114.77.121:9000&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

跪求大佬帮忙看看是什么原因

Steps to reproduce

1.创建一个vue2项目
2.下载@yume-chan/adb这个包
3.在组件中引入这个包,并且使用
4.运行项目,就会看到报错

另外:我也尝试使用tsx项目,也会报同样的错误

Can you provide your project or a minimal repro?

你可以自行用vue-cli命令创建一个vue2项目,我现在这个demo就是用的这个创建项目,然后npm i @yume-chan/adb

`

connect

{{ msg }}

For a guide and recipes on how to configure / customize this project,
check out the vue-cli documentation.

Installed CLI Plugins

Essential Links

Ecosystem

<script> import {Adb} from '@yume-chan/adb' import { AdbWebUsbBackendManager, // AdbWebUsbBackendWatcher } from "@yume-chan/adb-backend-webusb"; export default { name: 'HelloWorld', props: { msg: String }, methods: { connectFunc() { const devices = AdbWebUsbBackendManager?.BROWSER.requestDevice() console.log(devices, '获取的设备', Adb) } } } </script> <style scoped> h3 { margin: 40px 0 0; } ul { list-style-type: none; padding: 0; } li { display: inline-block; margin: 0 10px; } a { color: #42b983; } </style>

` 我提供部分的代码,你帮忙查看一下是什么原因导致的,谢谢!

Close as stale. Please provide your full project if you still have issues.