#848·sapper

src/routes/index/index.svelte

Author: markotarnajCreated Aug 14, 2019Updated Oct 19, 2021
Labelsproposal

Description

According to documentation:

src/routes/about/index.svelte is treated the same as src/routes/about.svelte

It is reasonable to assume that src/routes/index/index.svelte would be treated the same as src/routes/index.svelte. So I created the following structure:

routes
├── about
|   ├── index.svelte
|   └── components
├── contact
|   ├── index.svelte
|   └── components
├── index
|   ├── index.svelte
|   └── components
├── _error.svelte
└── _layout.svelte

which results in a 404 on index. As a workaround I simply added an empty index.svelte file inside /routes, and that fixed everything:

routes
├── about
|   ├── index.svelte
|   └── components
├── contact
|   ├── index.svelte
|   └── components
├── index
|   ├── index.svelte
|   └── components
├── _error.svelte
├── _layout.svelte
└── index.svelte

For some reason it doesn't load the empty routes/index.svelte, but it loads the routes/index/index.svelte which seems counter-intuitive.

Logs

(index):1 Failed to load resource: the server responded with a status of 404 (Not Found)

Expected behavior

Treat src/routes/index/index.svelte same as src/routes/index.svelte.

Version info:

  • Sapper 0.27.0
  • Svelte 3.0.0
  • Rollup