-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix $app/paths import not working at dev mode inside context="module" #2145
Conversation
|
This comment has been minimized.
This comment has been minimized.
ps: locally atop of this PR, I have fix for #2108 in dev and preview modes In short I changed manifest routes pattern generation to include basePath, and cleared few places where basePath were spliced from pathname. Even such solution doesnt allow dynamic basePath now, but it can be extended to be dynamic by changing pattern match logic a little bit. |
/** @type {import('@sveltejs/kit').Load} */ | ||
export async function load({ page, fetch }) { | ||
const res = await fetch('/host.json'); | ||
const res = await fetch(`${base}/host.json`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something you're going to want to do for every URL within the app or should we add a base
html tag or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw I havent knew about base tag. :-) so probably its much better.
Would check tomorrow
Thank you — the current behaviour was semi-intentional, but a little bit confusing (and error-prone, since you could easily forget to prefix URLs with I think the So I wonder if it makes sense to have a fake |
Probably one of options would be to simplify a little bit. In case of relative For example our use case is PR deployments, because of 3rd party lib referer restrictions (no wildcards supported etc) we can't deploy each PR on own sub domain. So what we really need that same code work on any base path depending on env variable. With our usecase we can set If someone need different path for assets seems like changing So probably assets config must accept only non relative urls with schema defined i.e At least for our usecase no need to do something like In case of non relative assets fake path can be an option. |
🤯 this is... a great point. I don't think there is a good use case. We should probably just prohibit relative asset paths and use a fake one during development and preview. I have a bit of time today so will work on this now. I've found |
closing in favour of #2189 — thanks |
ref #2108
I've started playing with #2108 and found that
Always return default values at dev and preview at serverside.
This is attempt to fix above.
Steps.
Without above its hard to proceed with full paths.base support. As { base } import at module level would be needed for tests.