Skip to content

fix: Aliased exports to already exported component for "use client" #493

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

Merged
merged 2 commits into from
Jun 4, 2025

Conversation

justinvdm
Copy link
Collaborator

For the worker environment, when transforming "use client" modules that export a component with both its original name and an aliased name:

"use client"

export const Slot = () => {
  return jsx('div', { children: 'Slot' });
}

export { Slot, Slot as Root }

... the result looked like this - note the const that appears twice:

import { registerClientReference } from "rwsdk/worker";

const Slot = registerClientReference("/test/file.tsx", "Slot");
const Slot = registerClientReference("/test/file.tsx", "Root");  // same const as line above!

export { Slot, Slot as Root };

This PR fix this so that we correctly qualify the names for the alias case:

import { registerClientReference } from "rwsdk/worker";

const Slot = registerClientReference("/test/file.tsx", "Slot");
const Slot_Root = registerClientReference("/test/file.tsx", "Root");

export { Slot, Slot_Root as Root };

@justinvdm justinvdm merged commit 33e0a3b into main Jun 4, 2025
5 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
Development

Successfully merging this pull request may close these issues.

1 participant