docs: Improve onStackTrace docs to include limitations and tips
#8905
+7
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
As discussed here: #8149
I've updated the docs to include a callout to the V8 stack trace limit feature, and to mention that the stack trace filtering doesn't apply to regular console logs that might get printed by
printConsoleTraceI've tried to fix the latter by calling the appropriate filtering functions, but it looks like
printConsoleTraceis implemented in workers, which only have access to the serialized config, which of course lacks theonStackTracefiltering function.In the discussion we also talked about removing the
.slicefrom this code path since it might limit the stack frames to the first 6, but after a second look I think it's doing the opposite, basically removing the first 6 stack frames that are vite internals in a transparent way, which I think probably helps make the stack frames more readablePS If you know how could/should I add the filter function to the serialized config in workers, so it could apply to
printConsoleTraceI'd be happy to have a go at it, but couldn't find examples of similar things in the config, and this seems like it could be a performance critical problem.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.