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

[QUESTIONS] about the range for route hydrate prerender and the range for loading files. #6364

Closed
lukaszpolowczyk opened this issue Aug 29, 2022 · 4 comments

Comments

@lukaszpolowczyk
Copy link
Contributor

lukaszpolowczyk commented Aug 29, 2022

Describe the problem

Why can't route, hydrate, prerender be added in +layout.js?
If you can set these properties in svelte.config.js, why not in +layout.js?

Similarly, I am curious about the "$lib/".
And shouldn't it be possible to reference any superdirectory in routes, conveniently?
Like in Advenced layout you can refer to higher directories, by their name via at (@).
For example, something like this:
./@/, ./@(app)/, ./@item/ or ./@[id]/.

This is more of a question than a need. It puzzles me, and I'd like to know if it's completely unnecessary or not supported for some other reason (e.g., it didn't occur to anyone).

Describe the proposed solution

Simply support route, hydrate, prerender in +layout.js.

Adding support for importing from such url:
./@/, ./@(app)/, ./@item/ or ./@[id]/.

Alternatives considered

No response

Importance

would make my life easier

Additional Information

No response

@dummdidumm
Copy link
Member

dummdidumm commented Aug 29, 2022

I don't understand what you mean by the @ question; you can import code from upper directories if you want.

Regarding the options question: This will be done in #6197 and #6356

@dummdidumm dummdidumm closed this as not planned Won't fix, can't repro, duplicate, stale Aug 29, 2022
@lukaszpolowczyk
Copy link
Contributor Author

lukaszpolowczyk commented Aug 29, 2022

@dummdidumm

I don't understand what you mean by the @ question; you can import code from upper directories if you want.

$lib/ "allows you to access common components and utility modules without ../../../../ nonsense."
(quote from documentation)

What I am writing about is analogous.
Currently you have to use " ../../../../../ nonsense" to "import code from upper directories", in routes.

Using a layout analogous to "Advenced layout", one avoids the ../../../../../ nonsense".
The same as with $lib/. This is the meaning of the existence of $lib/.

Do you understand now?


Regarding the options question: This will be done in #6197 and #6356

Thanks. I hadn't noticed.

@dummdidumm
Copy link
Member

Ok I see. This would introduce needless complexity and would mean restarting your dev server all the time since we would have to

  • parse the route folder on each change
  • somehow create aliases from it which we hand to vite
  • vite would restart since that's a config change

It would also create conflicts because as soon as you have two folders with the same name in different parts of your router tree.

So no, we won't do this.

@lukaszpolowczyk
Copy link
Contributor Author

Ok. I get it.

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

No branches or pull requests

2 participants