stencil-community / stencil-router

A simple router for Stencil apps and sites
https://stenciljs.com/
MIT License
189 stars 55 forks source link

Routes dont work when not explicitly importing `MatchResults` #62

Open r0skar opened 6 years ago

r0skar commented 6 years ago

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

  1. Clone the starter app at https://github.com/ionic-team/stencil-starter.git and install it as usual.
  2. Start the app => the app-home component is shown.
  3. Delete app-profile and remove the route from the stencil-route-switch component in the app-root component. => everything seems to be working as expected.
  4. 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.

hicksy commented 6 years ago

This just happened to me also. SO glad I found this issue 👍

safebyte commented 5 years ago

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"