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 link to public fails if you put the parameter "base" and then remove it #6067

Closed
1 task
afandos-bbm opened this issue Jan 31, 2023 · 5 comments · Fixed by #8027
Closed
1 task

The link to public fails if you put the parameter "base" and then remove it #6067

afandos-bbm opened this issue Jan 31, 2023 · 5 comments · Fixed by #8027
Assignees
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: hmr Related to HMR (scope)

Comments

@afandos-bbm
Copy link

afandos-bbm commented Jan 31, 2023

What version of astro are you using?

2.0.2

Are you using an SSR adapter? If so, which one?

No

What package manager are you using?

Tested with npm and pnpm

What operating system are you using?

Windows

Describe the Bug

The problem is that once you put the "base" parameter in the astro.config.mjs file, if you later remove it, it still keeps the base prefix.

Steps to reproduce:

  1. Clone Minimal reproducible example or Create a basic app with astro.
    npm create astro@latest
  2. If you have created a new app add any svg or any other file in the "public" folder
    step2
  3. Use the file in any astro file.
    step3
  4. You run astro with "npm run dev" and everything works.
  5. In the file "astro.config.mjs" you add the base parameter with any value.
  6. It will warn you that you must change the url adding the value that you have entered in "base" so that it works in production. But it still works.
  7. Remove the base parameter from the "astro.config.mjs" file
    and it stops working as it still requires the "base". It shows a 404 code in the console.
    step7
    Click on image to better view

Link to Minimal Reproducible Example

https://github.com/alejandrofan2/astro-bug-base

Participation

  • I am willing to submit a pull request for this issue.
@matthewp
Copy link
Contributor

matthewp commented Feb 2, 2023

So this is an HMR related issue, right?

@matthewp matthewp added - P3: minor bug An edge case that only affects very specific usage (priority) feat: hmr Related to HMR (scope) labels Feb 2, 2023
@JerryWu1234
Copy link
Contributor

JerryWu1234 commented Feb 8, 2023

The last version didn't happen on my side.
Someone's PR may have fixed this bug.

@afandos-bbm
Copy link
Author

@matthewp It's very possible but I'm not entirely sure.

@JerryWu1234
Copy link
Contributor

@matthewp It's very possible but I'm not entirely sure.

Is that still the case?

@matthewp matthewp self-assigned this Feb 10, 2023
@natemoo-re
Copy link
Member

Unfortunately I can confirm that this is still an issue. seems like our middleware for handling public assets isn't regenerated when the config triggers a restart.

natemoo-re added a commit that referenced this issue Aug 10, 2023
* fix(#6067): dev server restart respects base removal

* chore: remove baseCss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: hmr Related to HMR (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants