-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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(ssr): fix sourcemap content (fixes #8657) #8997
Conversation
✅ Deploy Preview for vite-docs-main canceled.
|
test('sourcemap source', async () => { | ||
expect( | ||
(await ssrTransform(`export const a = 1`, null, 'input.js')).map.sources | ||
).toStrictEqual(['input.js']) | ||
const map = ( | ||
await ssrTransform( | ||
`export const a = 1`, | ||
null, | ||
'input.js', | ||
'export const a = 1 /* */' | ||
) | ||
)?.map | ||
expect(map?.sources).toStrictEqual(['input.js']) | ||
expect(map?.sourcesContent).toStrictEqual(['export const a = 1 /* */']) |
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.
Changes in this file except this change is just a refactor.
@@ -258,7 +259,7 @@ async function loadAndTransform( | |||
} | |||
|
|||
const result = ssr | |||
? await ssrTransform(code, map as SourceMap, url, { | |||
? await ssrTransform(code, map as SourceMap, url, originalCode, { |
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.
Instead of passing originalCode
, we could always generate sourcemaps. But that will cost a lot if the file is large.
Description
For js,
sourcemapContent
was including the transformed content.For ts,
sourcemapContent
was not included.fixes #8657
Additional context
I'm not sure if this is the best approach.
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).