-
Notifications
You must be signed in to change notification settings - Fork 18
feat: support load typescript file #23
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
base: master
Are you sure you want to change the base?
Conversation
|
code from: #21, fix lint error |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #23 +/- ##
=======================================
Coverage 96.75% 96.75%
=======================================
Files 5 5
Lines 185 185
=======================================
Hits 179 179
Misses 6 6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
这 2 个 PR 的关系是? 那边还有几个 Review 问题还没解决 |
代码是一样的,只有一个 lint 问题修复了,但是看原作者好像没打算继续更新。 |
|
@whxaxes 看下 |
|
ping @whxaxes |
|
补一下单测 |
| } | ||
|
|
||
| if (stat.isFile() && path.extname(name) === '.js') { | ||
| if (stat.isFile() && [ '.js', '.ts' ].includes(path.extname(name))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里感觉有问题,如果项目下刚好同时存在同名的 .js 和 .ts 文件,但是又没有使用 ts-node ,下面的 require 就会出问题
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有改法建议吗?@whxaxes
|
|
||
| if (stat.isFile() && path.extname(name) === '.js') { | ||
| if (stat.isFile() && [ '.js', '.ts' ].includes(path.extname(name))) { | ||
| let handler = require(filepath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里直接 require 也会有问题,ts compile 出来的 js 是 esm ,模块内容是挂在 default 中的
Checklist
npm testpassesAffected core subsystem(s)
Description of change