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

refactor: vite for kv-components #507

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

refactor: vite for kv-components #507

wants to merge 2 commits into from

Conversation

emuvente
Copy link
Collaborator

Started doing this so that KvFlag and the flag svgs could be transpiled in the library, avoiding the need for UI or CPS to handle it. Still WIP.

TODO

  • import flag svg as needed instead of embedding all urls in css
  • fix package exports definitions

…e storybook

BREAKING CHANGE: dist folder structure is different, so existing import statements will not work
@mcstover
Copy link
Collaborator

What creates the need to have a folder and additional index for every component? Is there a way around that?

I can see the usefulness of synchronizing within this repo with or without the .vue extension but this still leaves a .vue usage for each component import in the index files. Could we just skip having to change that everywhere and allow .vue extensions in vite and eslint.

We could also look at using an alias in vite to resolve without a relative path...something like #components/MyComponent instead of ../../... It would of course also require a bunch file updates to implement... 🤷

@emuvente
Copy link
Collaborator Author

What creates the need to have a folder and additional index for every component? Is there a way around that?

This structure is from a guide for component libraries I was following. Each index is an entry point for the library. It allows individual fully-built components to be used without depending on the rest of the library and without needing an additional build step. We can also use those individual index files to inject type definitions, if/when we add typescript to this. If we use just the top-level index file, we might not get tree-shaking with the output and it might be harder to add type definitions. I'm still testing the consumer side of this setup, and I'll change it if I can.

We could also look at using an alias in vite to resolve without a relative path...something like #components/MyComponent instead of ../../... It would of course also require a bunch file updates to implement... 🤷

Yeah, that's a good idea. I probably should have started with that. Find & replace will make easy work of it at least

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.

2 participants