stencil-router icon indicating copy to clipboard operation
stencil-router copied to clipboard

import '@stencil/router';

Open stefanhuber opened this issue 5 years ago • 8 comments

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'; 

stefanhuber avatar Jun 04 '19 18:06 stefanhuber

@shallurohilla Thank you for posting it here at least.

warapitiya avatar Jun 26 '19 05:06 warapitiya

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

shreeshbhat avatar Jun 28 '19 01:06 shreeshbhat

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!

PurpleEdge2214 avatar Aug 09 '19 00:08 PurpleEdge2214

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

stefanhuber avatar Aug 09 '19 05:08 stefanhuber

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

npm init stencil pwa

...doesn't create anything like that?

PurpleEdge2214 avatar Aug 10 '19 01:08 PurpleEdge2214

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.

sniederb avatar Sep 24 '20 12:09 sniederb

Thanks for sharing. Using this for component

ianemv avatar Sep 30 '20 16:09 ianemv

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

AlexSapoznikov avatar Nov 16 '20 12:11 AlexSapoznikov