fix(core): allow empty static directories#7285
Merged
Conversation
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site settings. |
|
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-7285--docusaurus-2.netlify.app/ |
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site settings. |
|
Size Change: +75 B (0%) Total Size: 805 kB
ℹ️ View Unchanged
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-flight checklist
Motivation
It turns out that simply
ensureDiris not sufficient to make build succeed with an empty static folder. To reproduce, domkdir website/_dogfooding/emptyStaticDir, and add_dogfooding/emptyStaticDirto thestaticDirectorieslist, then runyarn build -l en. Server build errors with:This seems to be a bad thing to happen for a glob pattern, but just in case, I've simply filtered out all non-existent directories instead of creating empty ones. This also means the user doesn't magically have a static folder created after every build.
Test Plan
Tested locally with the above reproduction. I don't really know how to add a dogfooding test—my suspicion is it's impossible to do it in a simple way, because empty dirs aren't checked in to git... I just added a directory that doesn't exist, which should do half the job.
Related issues/PRs
#6311