Skip to content
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): preserve source maps for hoisted imports (fix #16355) #16356

Merged
merged 6 commits into from
Oct 24, 2024

Conversation

smcenlly
Copy link
Contributor

@smcenlly smcenlly commented Apr 5, 2024

Description

fixes #16355

Copy link

stackblitz bot commented Apr 5, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@sapphi-red sapphi-red added p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority) feat: sourcemap Sourcemap support feat: ssr labels Aug 21, 2024
sapphi-red
sapphi-red previously approved these changes Oct 17, 2024
@sapphi-red
Copy link
Member

/ecosystem-ci run

@vite-ecosystem-ci
Copy link

@hi-ogawa
Copy link
Collaborator

I'm running some examples locally and 2nd import doesn't get hoisted?

  expect(await ssrTransformSimpleCode(`\
console.log(foo.bar);
console.log(foo2.bar);
import foo from 'libx';
import foo2 from 'liby';
`)).toMatchInlineSnapshot(`
  "const __vite_ssr_import_0__ = await __vite_ssr_import__("libx", {"importedNames":["default"]});
  console.log(__vite_ssr_import_0__.default.bar);
  console.log(__vite_ssr_import_1__.default.bar);
  const __vite_ssr_import_1__ = await __vite_ssr_import__("liby", {"importedNames":["default"]});


  "
`)

@sapphi-red
Copy link
Member

I'm running some examples locally and 2nd import doesn't get hoisted?

Thanks, I pushed a commit to fix that.

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@bluwy bluwy changed the title fix: missing source maps for hoisted imports (fix #16355) fix(ssr): preserve source maps for hoisted imports (fix #16355) Oct 24, 2024
@patak-dev patak-dev merged commit 8e382a6 into vitejs:main Oct 24, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: sourcemap Sourcemap support feat: ssr p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority)
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Source maps missing for hoisted imports for ssrTransforms
5 participants