-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix(vite-node): fix source map of inlined node_modules #7557
base: main
Are you sure you want to change the base?
fix(vite-node): fix source map of inlined node_modules #7557
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -0,0 +1,11 @@ | |||
import 'node:path' | |||
|
|||
export function testStack() { |
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.
Currently ssr transform doesn't preserve lines with export
, so this repro fails on main.
@@ -428,7 +428,7 @@ export class ViteNodeServer { | |||
} | |||
|
|||
const sourcemap = this.options.sourcemap ?? 'inline' | |||
if (sourcemap === 'inline' && result && !id.includes('node_modules')) { | |||
if (sourcemap === 'inline' && result) { |
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.
I think similar change was proposed before:
We don't inline source map because it's expensive to do for every file in node modules
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.
Yes, we can make it to opt-in (like #7095) if broken debugger and stacktrace for inlined deps are acceptable by default, but I'm leaning towards just aligning with Vite SSR.
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.
Yes, we had a discussion with the rolldown team not so long ago and decided to remove this check after all
New test is not running on CI due to #7558. We need to merge that first. |
Description
Related
deps.includeSourcemap
#7095Currently ssr transform tries to preserve lines by best effort vitejs/vite#19004, but this is not guaranteed since user plugin can also change lines and also there are some not-so-edge cases ssr transform has't handle it yet (I added it as a test case).
Considering Vite SSR / module runner is also injecting source map (regardless of user code or inlined deps), I think we should allow this for Vitest / vite-node as well.
Also as an important context, preserving lines for transform is hard for the ecosystem for the following aspects:
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.