Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Don't create fallback routes #309

Closed
wants to merge 2 commits into from
Closed

Conversation

Rich-Harris
Copy link
Member

Am in two minds about this one. In #308, if you have something like routes/foo/bar/baz.html but don't have (say) routes/foo/index.html, Sapper will import a fallback component that looks like this:

<svelte:component this={child.component} {...child.props}/>

Since routes/foo/index.html would probably look like that anyway, we can a) save the developer some typing, b) avoid cluttering routes, and c) prevent the situation where you have multiple components that look like that, duplicated unnecessarily, which is good for file size. You'd then only need to create an intermediate index.html file if you needed specific markup or behaviour.

However, it's less explicit, and it's possible to create a webpack config that breaks it, by only compiling components inside routes.

So for now I'm just going to leave it here as a PR to the original PR.

@Rich-Harris
Copy link
Member Author

Came up with a solution I like much better — write the default layout component to the manifest directory. Explicit, and more or less guaranteed to be compiled correctly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant