-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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(vite): full source-map support for ssr #3300
Conversation
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.
69ac90c
to
f31b726
Compare
@Shinigami92 I've now rebased and added the return type a suggested. |
I tried this PR against // Check whether `val` is a plain JavaScript object
function isPlainObject(val) {
return val && val.constructor === Object;
} The I couldn't find an alternative way to implement If I remove all The Also, forcing my users to use It would be super neat to get rid of |
@brillout probably this should be changed to not rely on Regarding |
@DylanPiercey Neat digging 👍. I'm just seeing:
How would we allow Vite users to override
Do we know whether there are breaking changes between
Thoughts on this? IMO, forcing all users to use a flag is less than ideal. Does Node.js plan to set the flag to true by default? @vdeturckheim
I don't know how |
Actually, why don't we use |
@brillout that would only solve part of the issue. The main issue from my perspective is that there is no way currently to hook up a debugger with proper source maps when using vite for ssr. |
I don't know but it would sound weird to me to enable such behaviour by default in node. I don't know Vite enough to think of alternatives that could fit the desired UX. |
I opened a feature request to replace |
Closing in favor of #3928 |
Description
This PR implements my suggestion from and resolves #3288.
With this change SSR modules transformed via
ssrLoadModule
now receive an inlinesourceMappingURL
as a datauri.This means with
--enable-source-maps
or using--require source-map-support/register
with node debugging, errors and whatnot are all source mapped properly.Additional context
One performance related detail about this implementation is that I've set it up to avoid serializing
sourcesContent
when there is already a file on disk by checking formod.file
. If there is no file then it will inline the sources content.Also because this change should invalidate the need for
ViteDevServer.ssrFixStacktrace
I have deprecated it in this PR. We could however keep it around if anyone thinks there is any value there.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).