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 exports in index when using --filename-case option #495

Closed
wants to merge 1 commit into from

Conversation

TimonVS
Copy link
Contributor

@TimonVS TimonVS commented Oct 1, 2020

Summary

Using the --filename-case option with kebab-case would break exports from the generated index file as it would use the filename as the export name. It doesn't break for PascalCase and camelCase, though in the case of camelCase, the export would also be camelCased even though it should always use PascalCase.

I'm not extremely happy with the solution, as I'd much rather abstract it away from defaultIndexTemplate, but that would require a breaking change which I don't think is worth it.

Another solution I was thinking about is using export * from './icon-name' (also requires a breaking change) but the generated icon component files are using export default and the component names include a prefix like Svg and/or Memo when using momoization etc. which the index file strips away.

Test plan

I've added snapshot tests :)

@vercel
Copy link

vercel bot commented Oct 1, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/gregberge/svgr/ie41mnv0k
✅ Preview: https://svgr-git-fork-timonvs-fix-filename-case-index.gregberge.vercel.app

@TimonVS
Copy link
Contributor Author

TimonVS commented Oct 1, 2020

I should've looked more closely at the open PRs 🤦 . Seems like #489 already fixes the issue.

@TimonVS TimonVS closed this Oct 1, 2020
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