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): fix transform error due to export all id scope #19331

Merged

Conversation

hi-ogawa
Copy link
Collaborator

@hi-ogawa hi-ogawa commented Feb 1, 2025

Description

Even on Vite 5, SSR transform wasn't properly handling the identifier from export * as id from ".." as seen by the same repro https://stackblitz.com/edit/github-pnyojxdr-mena4fdt?file=repro-vite.js

const __vite_ssr_import_0__ = await __vite_ssr_import__('x');

const __vite_ssr_import_1__ = await __vite_ssr_import__('x');

Object.defineProperty(__vite_ssr_exports__, 'x', {
  enumerable: true,
  configurable: true,
  get() {
    return __vite_ssr_import_1__;
  },
});
__vite_ssr_import_0__; /// <-- what's this?

I haven't investigated why this now causes magic-string error, but this can be fixed by fixing isRefIdentifier to skip identifiers inside export * ....

@hi-ogawa hi-ogawa marked this pull request as ready for review February 1, 2025 09:16
@patak-dev patak-dev merged commit e28bce2 into vitejs:main Feb 1, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants