stencil-community / stencil-router

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

import '@stencil/router'; #96

Open stefanhuber opened 5 years ago

stefanhuber commented 5 years ago

It should be mentioned somewhere that the router needs to be imported within the root stencil component otherwise nothing works. This is IMHO not documented anywhere...

import '@stencil/router'; 
warapitiya commented 5 years ago

@shallurohilla Thank you for posting it here at least.

shreeshbhat commented 5 years ago

This issue tripped me up too. Must be documented indeed 👍

PurpleEdge2214 commented 5 years ago

Where is it imported in the default application?

Can you give an example of what doesn't work without the import?

I'm asking because the stenciljs documentation is so thin I'm not sure what I'm missing out on!

stefanhuber commented 5 years ago

I don't know what you mean by the default application, however if you take a look at the stencil-site it is imported inside the app-root component: https://github.com/ionic-team/stencil-site/blob/master/src/components/app-root/app-root.tsx

PurpleEdge2214 commented 5 years ago

Thanks @stephanhuber, we must be talking about different things?

npm init stencil pwa

...doesn't create anything like that?

sniederb commented 3 years ago

Just cost me more than 1h to figure this out. What's remarkable is that in the demo, src/components.d.ts does import @stencil/router, but this is a generated file. The root tsx, src/components/router-demo-app.tsx, is lacking that import statement.

ianemv commented 3 years ago

Thanks for sharing. Using this for component

AlexSapoznikov commented 3 years ago

JEEZ, I spent about an hour just trying to figure out why nothing works. Thanks man!