Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

引入第三方包,yarn run dev:swan时,出现错误:Property id of VariableDeclarator expected node to be of a type ["LVal"] but instead got "StringLiteral" #7693

Open
hongxinfeiyang opened this issue Sep 22, 2020 · 2 comments
Labels
F-react Framework - React T-swan Target - 编译到百度小程序 V-2 Version - 2.x

Comments

@hongxinfeiyang
Copy link

相关平台

百度小程序

小程序基础库: 也版本无关
使用框架: React

复现步骤

安装第三方包 @baidu/ug-swan-utils
然后执行 yarn run dev:swan

报错如下:
taro2-test/node_modules/@baidu/ug-swan-utils/dist/index.js: Property id of VariableDeclarator expected node to be of a type ["LVal"] but instead got "StringLiteral"

at Object.validate (/taro2-test/node_modules/babel-types/lib/definitions/index.js:109:13)
at Object.validate (/taro2-test/node_modules/babel-types/lib/index.js:505:9)
at NodePath._replaceWith (/taro2-test/node_modules/babel-traverse/lib/path/replacement.js:176:7)
at NodePath.replaceWith (/taro2-test/node_modules/babel-traverse/lib/path/replacement.js:160:8)
at replaceAndEvaluateNode (/taro2-test/node_modules/babel-plugin-transform-define/lib/index.js:117:12)
at processNode (/taro2-test/node_modules/babel-plugin-transform-define/lib/index.js:143:5)
at PluginPass.Identifier (/taro2-test/node_modules/babel-plugin-transform-define/lib/index.js:23:9)
at newFn (taro2-test/node_modules/babel-traverse/lib/visitors.js:276:21)
at NodePath._call (/taro2-test/node_modules/babel-traverse/lib/path/context.js:76:18)
at NodePath.call (/taro2-test/node_modules/babel-traverse/lib/path/context.js:48:17)
at NodePath.visit (/taro2-test/node_modules/babel-traverse/lib/path/context.js:105:12)
at TraversalContext.visitQueue (/taro2-test/node_modules/babel-traverse/lib/context.js:150:16)
at TraversalContext.visitSingle (/taro2-test/node_modules/babel-traverse/lib/context.js:108:19)
at TraversalContext.visit (/taro2-test/node_modules/babel-traverse/lib/context.js:192:19)
at Function.traverse.node (/taro2-test/node_modules/babel-traverse/lib/index.js:114:17)
at NodePath.visit (/taro2-test/node_modules/babel-traverse/lib/path/context.js:115:19) _babel: true }

🙅 编译失败.

./node_modules/@baidu/ug-swan-utils/dist/index.js
Module Error (from ./node_modules/@tarojs/mini-runner/dist/loaders/wxTransformerLoader.js):

/taro2-test/node_modules/@baidu/ug-swan-utils/dist/index.js: Property id of VariableDeclarator expected node to be of a type ["LVal"] but instead got "StringLiteral"

期望结果

不会报这种类型错误

实际结果

出现报类型错误:Property id of VariableDeclarator expected node to be of a type ["LVal"] but instead got "StringLiteral"

环境信息

Taro CLI 2.2.14 environment info:
    System:
      OS: macOS High Sierra 10.13.4
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.14.2 - /usr/local/bin/node
      Yarn: 1.22.5 - /usr/local/bin/yarn
      npm: 6.4.1 - /usr/local/bin/npm
    npmPackages:
      @tarojs/components: 2.2.14 => 2.2.14
      @tarojs/components-qa: 2.2.14 => 2.2.14
      @tarojs/mini-runner: 2.2.14 => 2.2.14
      @tarojs/plugin-sass: 2.2.14 => 2.2.14
      @tarojs/plugin-terser: 2.2.14 => 2.2.14
      @tarojs/router: 2.2.14 => 2.2.14
      @tarojs/taro: 2.2.14 => 2.2.14
      @tarojs/taro-alipay: 2.2.14 => 2.2.14
      @tarojs/taro-h5: 2.2.14 => 2.2.14
      @tarojs/taro-qq: 2.2.14 => 2.2.14
      @tarojs/taro-quickapp: 2.2.14 => 2.2.14
      @tarojs/taro-rn: 2.2.14 => 2.2.14
      @tarojs/taro-swan: 2.2.14 => 2.2.14
      @tarojs/taro-tt: 2.2.14 => 2.2.14
      @tarojs/taro-weapp: 2.2.14 => 2.2.14
      @tarojs/webpack-runner: 2.2.14 => 2.2.14
      eslint-config-taro: 2.2.14 => 2.2.14
      eslint-plugin-taro: 2.2.14 => 2.2.14
      nerv-devtools: ^1.5.7 => 1.5.7
      nervjs: ^1.5.7 => 1.5.7
      stylelint-config-taro-rn: 2.2.14 => 2.2.14
      stylelint-taro-rn: 2.2.14 => 2.2.14
@taro-bot2 taro-bot2 bot added F-react Framework - React T-swan Target - 编译到百度小程序 V-2 Version - 2.x labels Sep 22, 2020
@xianguoGou
Copy link

I also encountered this problem

@yoyo837
Copy link
Contributor

yoyo837 commented Dec 23, 2022

盲猜一下 @baidu/ug-swan-utils 未适配 Taro?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-swan Target - 编译到百度小程序 V-2 Version - 2.x
Projects
None yet
Development

No branches or pull requests

3 participants