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

Identifiers are reused within the same module #1

Open
haykam821 opened this issue Feb 24, 2024 · 0 comments
Open

Identifiers are reused within the same module #1

haykam821 opened this issue Feb 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@haykam821
Copy link
Member

Applying source maps naively seems to have the side effect of introducing redeclaration within a single module. For example, the src/reddit/pages/Recap/index.tsx module contains the following code:

const RECAP_CARD = "PersonalizedYearInReviewCommentCard",
	RECAP_CARD = "PersonalizedYearInReviewEndCard",
	RECAP_CARD = "PersonalizedYearInReviewGenericCard",
	RECAP_CARD = "PersonalizedYearInReviewIntroCard",
	RECAP_CARD = "PersonalizedYearInReviewPostCard",
	RECAP_CARD = "PersonalizedYearInReviewShareCard",
	RECAP_CARD = "PersonalizedYearInReviewSubredditCard",
	RECAP_CARD = "PersonalizedYearInReviewSubredditListCard",
	RECAP_CARD = "PersonalizedYearInReviewSingleStatSubredditListCard",
	RECAP_CARD = "PersonalizedYearInReviewAvatarCard",
	RECAP_CARD = "PersonalizedYearInReviewTopicListCard",
	RECAP_CARD = "PersonalizedYearInReviewRPlaceTileListCard",
	RECAP_CARD = "PersonalizedYearInReviewSingleTopicCard",
	isPersonalizedYearInReviewShareCard = card => card.__typename === RECAP_CARD;

The mappings in question seem to come from multiple sources. The source map for the bundle mentions multiple sources that don't correspond to modules within the bundle:

{
	"sources": [
		// ...
		"webpack:///./src/reddit/pages/Recap/CardTemplates/CommentCard.tsx",
		"webpack:///./src/reddit/pages/Recap/CardTemplates/EndCard.tsx",
		"webpack:///./src/reddit/pages/Recap/CardTemplates/GenericCard.tsx",
		"webpack:///./src/reddit/pages/Recap/CardTemplates/IntroCard.tsx",
		"webpack:///./src/reddit/pages/Recap/CardTemplates/PostCard.tsx",
		"webpack:///./src/reddit/pages/Recap/CardTemplates/RplaceCard.tsx",
		"webpack:///./src/reddit/pages/Recap/CardTemplates/ShareCard.tsx",
		"webpack:///./src/reddit/pages/Recap/CardTemplates/SingleStatSubredditListCard.tsx",
		"webpack:///./src/reddit/pages/Recap/CardTemplates/SingleTopicCard.tsx",
		"webpack:///./src/reddit/pages/Recap/CardTemplates/SubredditCard.tsx",
		"webpack:///./src/reddit/pages/Recap/CardTemplates/SubredditListCard.tsx",
		"webpack:///./src/reddit/pages/Recap/CardTemplates/TopicListCard.tsx",
		// ...
	]
}

The redeclaration should be avoided in some way, such as by introducing modules based on source maps in addition to the Webpack module structure or by suffixing conflicting names.

@haykam821 haykam821 added the bug Something isn't working label Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant