-
Notifications
You must be signed in to change notification settings - Fork 37
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
feat: provides source map support for stack traces #19
Conversation
Codecov Report
@@ Coverage Diff @@
## master #19 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 6 6
Lines 169 187 +18
=====================================
+ Hits 169 187 +18
Continue to review full report at Codecov.
|
fe1b61e
to
df712bc
Compare
execArgvObj.require.push(require.resolve('source-map-support/register')); | ||
} | ||
|
||
argv.sourcemap = argv.typescript = argv.ts = undefined; |
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.
后面改造一下,需要哪些参数直接赋值,不然这种代码太多了。
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.
- 这里其实一句
argv.sourcemap = undefined
也够了。 上面有个 https://github.com/eggjs/egg-scripts/blob/ts/lib/command.js#L16 会自动删除别名。 - 之前的想法是,上层业务框架可能会自定义一些入参,这里更倾向于黑名单机制,也就是明确在工具层用的入参,在这里删掉。否则白名单机制的话,上层业务框架就要定制 egg-scripts 。
// execArgv | ||
if (argv.sourcemap) { | ||
execArgvObj.require = execArgvObj.require || []; | ||
execArgvObj.require.push(require.resolve('source-map-support/register')); |
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.
ts 不支持 sourcemap?
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.
ts 支持生成 sourcemap,这里是用来根据 sourcemap 还原堆栈的。可以看看 https://zhuanlan.zhihu.com/p/26267678
之前这个 require 都是放到 config 或 app.js agent.js ,或者放框架。
现在这个 PR 是直接在工具层引入了。
ping @popomore |
Checklist
npm test
passesAffected core subsystem(s)
Description of change