Ignore assets in src/pages/ to suppress warning "unsupported file type" #13319
+27
−6
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.
Changes
assetExtensions: string[]
toAstroSettings
VALID_INPUT_FORMATS
.addAssetExtension
toastro:config:setup
hook for customizing (dynamically and silently in the same way asaddPageExtension
)src/pages/
while constructing static routesMotivation
Astro regards
.astro
,.md
,.mdx
and etc. files insrc/pages/
directory as pages and builds static routes to them.By the way, image files to be optimized should be specified and inserted by relative path from the document:

orimport somethingImage from "./path/to/image"; <Image src={somethingImage} />
. It seems to be recommended to locate such assets insrc/assets/
directory, but I feel it irrational especially when there are many documents and assets in deep directory; tbh, we should locate referred assets in the same directory of the document.In this way, the problem emerges: noisily warned that "unsupported file type" is found in
src/pages/
directory for EACH asset file (by #9105).The initial change which introduced this (#6851) looks good and I think, respecting the PR, we should not take a quick solution: removing the warning or degrading it to debug level.
In addition, configurable structured logging may solve this, but it seems to be a hard job. So, this is a kind of workarounds.
Testing
There is no unit tests because the changed behavior is only warning.
Locating png file in
src/pages/
and inserting it in MDX, I tried buildingexample/with-mdx
and it ran as expected.Docs
There is no change to be documented.