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

Throw class not defined if decorator before export #5383

Closed
zqjimlove opened this issue Jan 22, 2020 · 2 comments
Closed

Throw class not defined if decorator before export #5383

zqjimlove opened this issue Jan 22, 2020 · 2 comments

Comments

@zqjimlove
Copy link

问题描述

当修饰符用在export之前,各个环境下都报not defined 错误。

复现步骤

具体看代码

@connect(
  ({apply}) => ({apply}),
  dispatch => ({
    updateOrderInfo: () => dispatch(updateOrderInfo())
  })
)
export default class chooseBank extends Component {

}

期望行为

成功运行

报错信息

ReferenceError: chooseBank is not defined

系统信息

Taro CLI 2.0.1 environment info:
System:
OS: macOS 10.15.2
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 10.14.2 - ~/.nvm/versions/node/v10.14.2/bin/node
Yarn: 1.16.0 - ~/.nvm/versions/node/v10.14.2/bin/yarn
npm: 6.13.4 - ~/.nvm/versions/node/v10.14.2/bin/npm
npmPackages:
@tarojs/async-await: 2.0.2 => 2.0.2
@tarojs/cli: 2.0.2 => 2.0.2
@tarojs/components: 2.0.2 => 2.0.2
@tarojs/mini-runner: 2.0.2 => 2.0.2
@tarojs/plugin-babel: 2.0.2 => 2.0.2
@tarojs/plugin-csso: 2.0.2 => 2.0.2
@tarojs/plugin-less: 2.0.2 => 2.0.2
@tarojs/plugin-uglifyjs: 2.0.2 => 2.0.2
@tarojs/redux: 2.0.2 => 2.0.2
@tarojs/redux-h5: 2.0.2 => 2.0.2
@tarojs/router: 2.0.2 => 2.0.2
@tarojs/taro: 2.0.2 => 2.0.2
@tarojs/taro-alipay: 2.0.2 => 2.0.2
@tarojs/taro-h5: 2.0.2 => 2.0.2
@tarojs/taro-qq: 2.0.2 => 2.0.2
@tarojs/taro-quickapp: 2.0.2 => 2.0.2
@tarojs/taro-swan: 2.0.2 => 2.0.2
@tarojs/taro-tt: 2.0.2 => 2.0.2
@tarojs/taro-weapp: 2.0.2 => 2.0.2
@tarojs/webpack-runner: 2.0.2 => 2.0.2
eslint-config-taro: 2.0.2 => 2.0.2
eslint-plugin-taro: 2.0.2 => 2.0.2
nerv-devtools: ^1.5.6 => 1.5.6
nervjs: ^1.5.6 => 1.5.6
stylelint-config-taro-rn: 2.0.2 => 2.0.2
stylelint-taro-rn: 2.0.2 => 2.0.2

补充信息

使用 babel 直接编译的代码能看到

var chooseBank = (_dec = (0, _redux.connect)();
Page(__webpack_require__(/*! @tarojs/taro-swan */ "./node_modules/@tarojs/taro-swan/index.js").default.createComponent(chooseBank, true));

但经过taro的会变成

_class = (_dec = (0, _redux.connect)();
Page(__webpack_require__(/*! @tarojs/taro-swan */ "./node_modules/@tarojs/taro-swan/index.js").default.createComponent(chooseBank, true));
@taro-bot
Copy link

taro-bot bot commented Jan 22, 2020

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@Garfield550
Copy link
Collaborator

Dup #5086

exportclass 分开写

class MyClass {}
export default MyClass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants