You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am mimicking the way our next apps output static content, in astro, because that works better with our current workflows in CI.
I have
dist/
sub-path.html
sub-path/[assets]
In astro, when I try to do the same behavior, with dist output set to sub-path, but moving the index.html to a level above, the dynamic imports don't work properly. (mv dist/sub-path/index.html dist/sub-path.html)
I realize this is probably because astro seems to rely on the trailing slash being present in the url (eg. http://localhost:8081/sub-path/, and being one level higher prevents that from working. In our case, we don't have trailing slashes.
It would be nice to be able to supply some value to Vite or otherwise, to set the path to what should be correct.
buildOptions.site seems to have no effect on this.
buildOptions: {site: 'http://localhost:8081/sub-path',// Your public domain, e.g.: https://my-site.dev/. Used to generate sitemaps and canonical URLs.// sitemap: false, // Generate sitemap (set to "false" to disable)},
Sorry for making a repro without stackblitz, I made it before opening the issue...
How to repro:
clone the repo
install the deps
run npm run docker-start
open localhost:8081/sub-path.html, it will have errors for the dynamic imports.
Thanks for making an issue for this. I’m sharing some information here from the related PR.
The related PR has been held up, because we know we shouldn’t (and probably can’t) block requests outside of the subpath. However, it looks like there’s a problem in the current solution if it doesn’t and those requests get passed along.
What version of
astro
are you using?0.22.16
What package manager are you using?
pnpm
What operating system are you using?
wsl2
Describe the Bug
I am mimicking the way our next apps output static content, in astro, because that works better with our current workflows in CI.
I have
In astro, when I try to do the same behavior, with dist output set to
sub-path
, but moving theindex.html
to a level above, the dynamic imports don't work properly. (mv dist/sub-path/index.html dist/sub-path.html
)I realize this is probably because astro seems to rely on the trailing slash being present in the url (eg.
http://localhost:8081/sub-path/
, and being one level higher prevents that from working. In our case, we don't have trailing slashes.It would be nice to be able to supply some value to Vite or otherwise, to set the path to what should be correct.
buildOptions.site seems to have no effect on this.
Sorry for making a repro without stackblitz, I made it before opening the issue...
How to repro:
npm run docker-start
Link to Minimal Reproducible Example
https://github.com/wbern/repro-astro-subpath
The text was updated successfully, but these errors were encountered: