#Unsupported file type
7 messages · Page 1 of 1 (latest)
Hi @rough rain. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Astro treats all files in the src/pages/ directory as potential routes or pages. If a file type is not recognized or supported, Astro will throw a warning. To have Astro ignore certain files, you can rename them (or the directory they’re in) to start with an underscore: _. This is mentioned in the Astro documentation on excluding pages (https://docs.astro.build/en/core-concepts/routing/#excluding-pages).
However, it's important to note that if you're not importing these files, they won't be copied to your build output. If these files need to be included in your build, you might need to place them in a different directory, such as src/public/.
In your case, the file index.astro.tsx seems to be a TypeScript file. Astro currently does not support TypeScript in .astro files. You should rename your file to index.astro if it's an Astro component. If it's a TypeScript file, it should be placed outside the src/pages/ directory or renamed to start with an underscore to be ignored by Astro.
Please refer to these discussions for more information:
- Unsupported file types found - .DS_Store (https://github.com/withastro/astro/issues/6031)
- Build fails when non-module JS-file is present in /pages (https://github.com/withastro/astro/issues/5873)
- A case of Typescript files inside Pages - Returning a Response from an endpoint is not supported in SSG mode in build mode (https://github.com/withastro/astro/issues/4824)
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@rough rain kapa.ai is still learning and improving, please let us know how it did by reacting below
@fleet void
But in mi project I just have a index.astro and about.astro, I've not installed react o any framework
Let me check the knowledge base for you. One moment! :books:
If you only have index.astro and about.astro in your src/pages/ directory and you're not using any JavaScript frameworks like React, then you shouldn't be seeing the Unsupported file type warning for a .tsx file.
Astro recognizes .astro files and treats them as pages. If you're seeing a warning for a .tsx file, it might be due to some misconfiguration or an issue with your development environment.
Here are a few things you can check:
-
Ensure that you don't have any
.tsxfiles in yoursrc/pages/directory. If you do, rename them to start with an underscore (_) to have Astro ignore them. -
Check your
astro.config.mjsfile to ensure that it's correctly configured. Here's a basic example of what it should look like:
import { defineConfig } from 'astro/config';
// <https://astro.build/config>
export default defineConfig({});
-
If you're using any Astro integrations, make sure they're correctly installed and configured. You can refer to the Astro Integrations Guide (https://docs.astro.build/en/guides/integrations-guide/) for more information.
-
If none of the above solutions work, consider creating a new Astro project and manually copying your
.astrofiles into the new project. This can help if the issue is due to some hidden configuration or environment issue.