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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When importing a file from a folder, have
index.sveltebe a default import.I ran into this minor inconvenience when importing components from folders:
This behaviour is already seen in routing where
src/routes/blogseemingly works. The same goes forindex.jsin$lib/components/modalwhich leads me to the precedence of these files:index.jsis already a default import, and with this addition,index.sveltewould clash with this. My suggestion is to haveindex.sveltetake precedence, but this is up for discussion.Some may point out you can replicate this behaviour by having an
index.jsfile 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