Default importing index.svelte from folders #5746
MauritsWilke
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When importing a file from a folder, have
index.svelte
be a default import.I ran into this minor inconvenience when importing components from folders:
This behaviour is already seen in routing where
src/routes/blog
seemingly works. The same goes forindex.js
in$lib/components/modal
which leads me to the precedence of these files:index.js
is already a default import, and with this addition,index.svelte
would clash with this. My suggestion is to haveindex.svelte
take precedence, but this is up for discussion.Some may point out you can replicate this behaviour by having an
index.js
file in the folder containing the following:but having to add this to all components is an unneeded hassle to something that seemingly already works in routing.
Beta Was this translation helpful? Give feedback.
All reactions