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

如何添加 reflect-metadata 支持? #3132

Closed
hannq opened this issue May 22, 2019 · 4 comments · Fixed by #5830
Closed

如何添加 reflect-metadata 支持? #3132

hannq opened this issue May 22, 2019 · 4 comments · Fixed by #5830
Labels
enhancement New feature or request

Comments

@hannq
Copy link
Contributor

hannq commented May 22, 2019

观察发现编译 *.ts 并没有采用 typescript 自带的 tsc 编译,似乎是使用的 babel 编译的
babel 要实现 reflect-matadata 需要使用 babel-plugin-transform-typescript-metadata 这个插件,
这个插件是基于 @babel/core: ^7,但是现在 taro 是使用的 babel-core: 6.26.3, 完全没法用

现在发现 taro 本身也有通过typescript编译的: plugin-typescript,
不知道在哪里配置

想知道可以通过什么方式实现

@taro-bot
Copy link

taro-bot bot commented May 22, 2019

欢迎提交 Issue~

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

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

Good luck and happy coding~

@Garfield550
Copy link
Collaborator

这部分我个人觉得暂时是没有办法配置的,编译工作大部分都是由 Taro CLI 自己管理的,暂不开放给开发者配置。仔细读文档也会发现只有 H5 会允许自定义部分 Webpack 配置,而小程序则几乎没有。

Babel 6 的问题需要等官方更新。

@dyk98
Copy link

dyk98 commented Jan 15, 2020

同问,想使用装饰器但是引入reflect-metadata无效,还是会Reflect.hasOwnMetadata不存在

@s97712
Copy link

s97712 commented Apr 13, 2021

加了

    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,

Reflect.getMetadata("design:type", cls); 还是不起作用

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

Successfully merging a pull request may close this issue.

5 participants