Replies: 2 comments 3 replies
-
|
You can use barrel files for re-exporting: pages/index.astro
layouts/index.astro
layouts/index.ts// layouts/index.ts
export { default as CustomName } from "./index.astro"---
// pages/index.astro
import { CustomName } from '../layouts';
---
<CustomName /> |
Beta Was this translation helpful? Give feedback.
1 reply
-
That's not technically correct. That's your bundler that does that (even vite). The ESM spec says that you must add the extension whe importing a file However, we also rely on the extension because we require the proper renderer in case you decide to import a client component inside your Astro file |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Body
Summary
Auto import files that have index.astro by their folder name.
Background & Motivation
Normally writing a folder name in js or ts would allow to import the component.
It make sense that astro would behave the same (without omitting the index.astro)
Beta Was this translation helpful? Give feedback.
All reactions