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
When setting e.g. base: "/my-astro-app" in astro.config.mjs all works as expected for output: "static"
✅ All static files are put to dist/my-astro-app
✅ The Website is accessible via http://localhost:port/my-astro-app/
✅ In the served HTML, the style is loaded correctly via <link rel="stylesheet" href="/my-astro-app/assets/index.857d2ba4.css">
✅ In the served HTML, the file paths of images are prefixed with my-astro-app
However, if I set output: "server" and pick e.g. the @astrojs/cloudflare adapter things behave differently:
❌ Website is not accessible via http://localhost:port/my-astro-app/ but via http://localhost:port/
✅ In the served HTML, the file paths of static assets e.g. images are prefixed with my-astro-app/
❌ In the served HTML, the rel attributed of the linked stylesheet is not prefixed with my-astro-app/: Instead of <link rel="stylesheet" href="/my-astro-app/assets/index.857d2ba4.css"> it's <link rel="stylesheet" href="/assets/index.857d2ba4.css">
❌ All files are put to dist/static/* instead of dist/static/my-astro-app/*
The same behavior is observable for other adapters such as @astrojs/netlify or @astrojs/node in standalone mode.
I would expect that the base property works the same independent whether output is set to static or server
I am willing to submit a pull request for this issue.
The text was updated successfully, but these errors were encountered:
cauboy
changed the title
The config value for the base property is not working as expected
The config value for the base property is not working as expected in SSR mode
Nov 3, 2022
What version of
astro
are you using?1.6.0
Are you using an SSR adapter? If so, which one?
Cloudflare (Same behavior observable for Netlify and node standalone)
What package manager are you using?
npm
What operating system are you using?
Mac
Describe the Bug
Here's my
astro.config.mjs
When setting e.g.
base: "/my-astro-app"
inastro.config.mjs
all works as expected foroutput: "static"
dist/my-astro-app
http://localhost:port/my-astro-app/
<link rel="stylesheet" href="/my-astro-app/assets/index.857d2ba4.css">
my-astro-app
However, if I set
output: "server"
and pick e.g. the@astrojs/cloudflare
adapter things behave differently:http://localhost:port/my-astro-app/
but viahttp://localhost:port/
my-astro-app/
rel
attributed of the linked stylesheet is not prefixed withmy-astro-app/
: Instead of<link rel="stylesheet" href="/my-astro-app/assets/index.857d2ba4.css">
it's<link rel="stylesheet" href="/assets/index.857d2ba4.css">
dist/static/*
instead ofdist/static/my-astro-app/*
The same behavior is observable for other adapters such as
@astrojs/netlify
or@astrojs/node
in standalone mode.I would expect that the
base
property works the same independent whetheroutput
is set tostatic
orserver
How to reproduce:
npm run build
npm run preview
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-zhdamn-rdbepz
Participation
The text was updated successfully, but these errors were encountered: