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

🐛 BUG: 0.26.0 needs publicDir declaration #2972

Closed
1 task
brycewray opened this issue Apr 3, 2022 · 3 comments · Fixed by #2973
Closed
1 task

🐛 BUG: 0.26.0 needs publicDir declaration #2972

brycewray opened this issue Apr 3, 2022 · 3 comments · Fixed by #2973

Comments

@brycewray
Copy link
Contributor

brycewray commented Apr 3, 2022

What version of astro are you using?

0.26.0

What package manager are you using?

npm

What operating system are you using?

macOS 12.3.1

Describe the Bug

If publicDir is not set in astro.config.mjs, Astro doesn’t use the default setting of ./publicDir — and, as a result, produces 404 errors for any content in the publicDir directory. Only if publicDir: './publicDir', is set will ./publicDir be recognized as the static assets directory.

Repo where demonstrated: https://github.com/brycewray/astro-site (URL for result is https://astro-site-vercel.vercel.app/). In the repo, I have commented out the publicDir line so you can see that many 404s appear in the browser Inspector.

Link to Minimal Reproducible Example

https://astro-site-vercel.vercel.app/

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added this to Needs Triage in 🐛 Bug Tracker Apr 3, 2022
@tony-sull
Copy link
Contributor

Looks like this is actually a mismatch between the docs and Astro global type definition, ./public is actually the default for the publicDir config

The blog-multiple-authors example starter shows this working properly, blog post images are kept in public/images and the blog posts load them fine without the publicDir config included

For reference, here's where the publicDir config option is defaulted to ./public (not the ./publicDir shown in the docs and typescript definition)

@brycewray
Copy link
Contributor Author

brycewray commented Apr 3, 2022

Looks like this is actually a mismatch between the docs and Astro global type definition, ./public is actually the default for the publicDir config

@tony-sull Interesting. I wonder if the same might be true for the outDir setting; because, after reading your reply, I realized I forgot to change that setting on the host, which means the host still built to, and then rendered from, a top-level dist directory as usual.

@tony-sull
Copy link
Contributor

Great catch! I just fixed the doc for outDir in #2973 as well

🐛 Bug Tracker automation moved this from Needs Triage to Done Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants