-
Notifications
You must be signed in to change notification settings - Fork 2
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
Implement subpath pattern exporting for papi-components #240
Comments
Thanks for adding this @rolfheij-sil. I did look into this when working on #179 but it wasn't clear to me that flat paths actually effect bundle size, in fact some people say it doesn't help at all and is separate from bundling. In the end I left it out because we are using tree-shaking and I know (from testing) that does remove any unused parts of |
I recommended this as it would make it a lot easier to understand what types and such come with which component. However, if there are disadvantages as you mention, maybe we should leave it alone. Can we do some kind of namespacing with another method to avoid throwing tons of disparate types all in one module? Thanks for the thoughts! |
Maybe we should consider subpaths for scripture utilties and hooks (assuming we end up putting hooks in here as I have been thinking maybe we should do) to keep things organized. Like here https://reviewable.io/reviews/paranext/paranext-core/468#-NfRW7MxE475_NAOStBG it's all at the same level, but that seems really hard to keep track of what's what. |
Our custom components, located in
lib/papi-components/src
are exported from a singleindex.ts
file.A cleaner solution would be to create a separate export file for each component.
More info can be found in the Node JS docs
Additional reads:
https://github.com/audi2014/react-async-concurrent/blob/main/docs/subpath-imports.md
vitejs/vite#8575
https://davidwells.io/blog/publishing-flat-npm-packages-for-easier-import-paths-smaller-consumer-bundle-sizes
https://stackoverflow.com/questions/44345257/import-from-subfolder-of-npm-package/61829317#61829317
The text was updated successfully, but these errors were encountered: