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

The config value for the base property is not working as expected in SSR mode #5288

Closed
1 task
cauboy opened this issue Nov 3, 2022 · 0 comments · Fixed by #5290
Closed
1 task

The config value for the base property is not working as expected in SSR mode #5288

cauboy opened this issue Nov 3, 2022 · 0 comments · Fixed by #5290
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)

Comments

@cauboy
Copy link

cauboy commented 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

import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';
import tailwind from '@astrojs/tailwind';

export default defineConfig({
  output: 'server',
  base: 'my-astro-app',
  adapter: cloudflare(),
  integrations: [tailwind()],
});

When setting e.g. base: "/my-astro-app" in astro.config.mjs all works as expected for output: "static"

  1. ✅ All static files are put to dist/my-astro-app
  2. ✅ The Website is accessible via http://localhost:port/my-astro-app/
  3. ✅ In the served HTML, the style is loaded correctly via <link rel="stylesheet" href="/my-astro-app/assets/index.857d2ba4.css">
  4. ✅ 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:

  1. ❌ Website is not accessible via http://localhost:port/my-astro-app/ but via http://localhost:port/
  2. ✅ In the served HTML, the file paths of static assets e.g. images are prefixed with my-astro-app/
  3. ❌ 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">
  4. ❌ 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


How to reproduce:

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-zhdamn-rdbepz

Participation

  • I am willing to submit a pull request for this issue.
@cauboy 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
@matthewp matthewp added the - P4: important Violate documented behavior or significantly impacts performance (priority) label Nov 3, 2022
@matthewp matthewp self-assigned this Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants