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

router not linking if a file called routes.ts exists in the routes folder

Open AEnterprise opened this issue 5 years ago • 2 comments

trying to use preact-router 3.0.0, but it is not creating links, or accepting variables for paths

demo project: preact-demo.zip

if you open the page you get an undefined error from using a variable as path hardcoding it to a string works, and you can manually go to the url (once the serviceworker is installed)

but a tags created with <Link> (in the header component) do not work at all, looking at the html it makes an a tag, but doesn't actually give a href, making them unclickable

AEnterprise avatar Apr 01 '19 09:04 AEnterprise

for got to add stacktrace of the error: image

AEnterprise avatar Apr 01 '19 09:04 AEnterprise

after some more digging around on slack this turned out to be 2 problems:

  1. you can't have any non component files in the reoutes folder, it turns them all into components when splitting, making things undefined
  2. just the existance of a file called routes.ts in the routes folder makes it unable to generate links, even if said file is not imported/used

AEnterprise avatar Apr 01 '19 09:04 AEnterprise