-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Make src/components
part of SvelteKit's domain
#480
Comments
Is this materially different from having an Separately, I recall reading that |
Not different at all, no — it's exactly that.
yes, sadly. Though in this case I think I'm okay with it since we need the known location for |
Are you attached to the If one of the reasons for the I apologize if it sounds like I'm being difficult. I'm just not yet convinced that |
Because you definitely don't want stuff in |
I would think if you're building a component, you'd want to just put your source in
Why would you even have |
Well I did specifically mention skipping routes in my comment. edit: Oh. Apparently I didn't entirely read Rich's comment.
Hmmmmmmm. I guess yeah it would be convenient to be able to just point to a place for consuming a project. (I was only thinking about what |
How would this change interact with Vite features like import globs or plugins like dynamic import vars? This was a feature I wanted to use for a blog-like setup. |
As I got to grips with architecture in node, I noticed a pattern of people using So I'm a little against the use of I should also mention that having a |
I'm not sure I understand. It sounds like you're saying the |
Sorry what I meant was that this |
There is no
Completely orthogonal — I haven't yet used those features personally, but they wouldn't be affected by this proposal at all.
The thought did occur to me. It could be anything — |
* implement $lib - closes #480 * clarify * changeset
At the moment,
src/components
(and the$components
alias) is really just a convention, nothing more. I think it might be better to remove the alias from the defaultvite.config.js
and into Kit itself for two reasons:$app
and$service-worker
aliases pointing to things that Kit controls, and it feels a bit weird that$components
is this whole other userland thing — the$
prefix feels like it should mean something that's provided by Kit, but it's not, and the distinction is slightly difficult to articulate (context: I'm going through the docs at the moment, and this stuck out)svelte-kit package
(name subject to 🐃 🪒 ) command that took the contents of your components folder and packaged it up as a library that could be consumed by other projects. (Every app has an internal component library of some kind; the distinction between an app with an internal component library and a component library whose app exists to showcase the components is merely one of focus.) For that to happen, the location of the component library needs to be known to SvelteKit, it can't live in the Vite config.At the same time, it's common for both component libraries and apps to need JS helper modules that can be imported from anywhere in the app with
../../../../
. A couple of times I've found myself adding new aliases like$utils
or$common
just because I feel weird putting those files in a directory called components.So my proposal is two-fold:
src/components
tosrc/lib
, and the alias from$components
to$lib
config.kit.files.lib === 'src/lib'
If we did this, the Vite config would become empty, so we could arguably remove it from the project template altogether (but reference it in the documentation for people who need to customise stuff).
The text was updated successfully, but these errors were encountered: