#Unsupported file type MyComponent.svelte found

2 messages · Page 1 of 1 (latest)

daring mirage
#

I added the Svelte integration for astro using bunx astro add svelte and everything seems to work fine functionality-wise. But I am getting the warning Unsupported file type .../MyComponent.svelte found. Prefix filename with an underscore (_) to ignore.

I can ignore it and everything still works but is this normal?

Link to my project that uses Astro + Svelte
https://github.com/Brian-Pob/tailwind-v4-vite

I can try to come up with a minimum repro if needed

GitHub

Contribute to Brian-Pob/tailwind-v4-vite development by creating an account on GitHub.

thorny rampart
#

Hi, Astro uses file-based routing, so every file placed within src/pages/ becomes a route. I think only the following file types are supported in that folder:

  • .astro
  • .markdown / .mdown / .mkdn / .mkd / .mdwn / .md
  • .js / .ts (endpoint)

If you want to colocate your components, you'll have to prefix _ to the file name as the warning suggested, so that those files don't turn into routes. You can read more here: https://docs.astro.build/en/guides/routing/#excluding-pages