stencil-router
stencil-router copied to clipboard
Routes dont work when not explicitly importing `MatchResults`
So... This is a very weird issue. And I am not 100% sure if its a bug or if this behavior is actually expected, but to me it seems very weird.
Issue
I was trying out the stencil app starter boilerplate and noticed, that all routes stop working (i.e. the app-home
route is not displayed) as soon as I delete the app-profile
component. There are no errors while compiling.
Steps to reproduce
- Clone the starter app at
https://github.com/ionic-team/stencil-starter.git
and install it as usual. - Start the app => the
app-home
component is shown. - Delete
app-profile
and remove the route from thestencil-route-switch
component in theapp-root
component. => everything seems to be working as expected. - Stop the app and restart it. => the
app-home
component is not shown.
More Information
I noticed that as soon as I import the MatchResults
from @stencil/router
, everything works just fine again. It doesnt matter where its being imported, but as soon as it is somewhere in the project, the app-home
route shows again. It also doesnt matter whether MatchResults
is actually being used anywhere.
This just happened to me also. SO glad I found this issue 👍
Happend to me as well with v0.3.3
, here's my dirty little fix to insert into the root
component:
import {MatchResults as _} from '@stencil/router'; // _ = !"declared but never read"