-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
doc: file url in stack traces contains file://
#39787
Comments
This comment has been minimized.
This comment has been minimized.
Hello! Is this open for contribution ? I would like to take up this. |
@nodejs/loaders I had someone ask about making the stack trace file paths consistent rather than documenting the differences. I expect there may be some correctness concerns about fully-qualified file URLs though so could use clarification here on what the "correct" fix would be, or if one can be made. I know historically Node.js has leaned a bit towards changes to error output being a breaking change. |
I think that |
True. So maybe the |
Yeah, I think consistency would be better even though CJS is limited to always being a local file. I'm not sure whether it's worth the breaking change (if it were just me, I would want the consistency). But, @hyrious mentioned it's better for many terminals—why? Perhaps adding the |
I'd be happy to take a look at it if we're ok with a breaking change in CJS. |
Not that detrimental. When I asked this problem, terminals (iTerm2, etc.) ware not able to recognize It's ok to see |
I just checked iTerm2, and a I command-clicked that link, and it opened that test file in the default text editor. Note that iTerm2 does not linkify URLs to files that do not actually exist. I also confirmed iTerm2 does linkify We can't check all terminal apps, but I think iTerm2 is the big one, so I think we should do as @Qard suggested and backport the |
Why should CJS have The most important consistency is that errors are consistent with the relevant module system. The two module systems have deliberate differences, and some of the inconsistencies between them are sadly intentional and unlikely to ever go away. |
Since it's required to have |
Quick update from a slack conversation with @Qard, @ljharb, @anonrig, and me: CJS cannot handle a So as-is, the output should not be updated (without a change to CJS to actually handle that as input, which is a separate debate). So I think that leaves us with 2 options:
|
This change highlihts in the docs difference between stack traces for CJS modules and ES Modules. Fixes: nodejs#39787
This change highlights in the docs difference between stack traces for CommonJS modules and ES Modules. Fixes: nodejs#39787
This change highlights in the docs difference between stack traces for CommonJS modules and ES Modules. Fixes: nodejs#39787
This change highlights in the docs difference between stack traces for CommonJS modules and ES Modules. Fixes: nodejs#39787 PR-URL: nodejs#41157 Reviewed-By: James M Snell <jasnell@gmail.com>
📗 API Reference Docs Problem
Version: v16.6.2
Platform: Darwin user.local 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64
Subsystem: -
Location
Affected URL(s):
Description
The doc says
However the error stack trace actually contains
file://
in es module files.I'm not sure if it occurs in other situations.
Consider this input:
Save and run
node a.js
:Save and run
node a.mjs
:What I have to mention here is sindresorhus/clean-stack#27, using normal path would be better in many terminals. Please take that into consideration too.
My suggestion is node.js always returning normal path in error stack trace.
submit a pull request.
The text was updated successfully, but these errors were encountered: