Skip to content

Identifiers are reused within the same module #1

@haykam821

Description

@haykam821

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions