swan-io / chicane

A simple and safe router for React and TypeScript.
https://swan-io.github.io/chicane/
MIT License
390 stars 9 forks source link

Default is not a func #39

Closed bay-jacewhitten closed 1 year ago

bay-jacewhitten commented 1 year ago

Bug summary

key: `${mumurhash(rawPath)}-${mumurhash(rawSearch + rawHash)}`,

so '/- ?page=users + no hash'

causes this =>

location.ts:31 Uncaught TypeError: (0 , bt.default) is not a function at ha (location.ts:31:13) at history.ts:26:23

This is in a react app propject that is NOT using Typescript.

Thanks.

Library version

latest

Environment info

latest chrome, react 18

Steps to reproduce

Using the lib

Reproducible sample code

Proprietary
zoontek commented 1 year ago

Sorry, but I don't get your issue at all 😅 Could you be more specific (or at least, rephrase)? What does this means: '/- ?page=users + no hash'? You have a route which is "/?:page"?

EDIT: I think I got it. Your bundler tells you that "@emotion/hash" default export is not a function? What are you using to bundle your code?

bay-jacewhitten commented 1 year ago

I am using esBuild to bundle. This is a pure JS , react, jsx solution, so no TS at this time unfortunately. I was able to move past my original issue using wouter. However, I would like to return to trying this library again when I don't have a deadline.

zoontek commented 1 year ago

@bay-jacewhitten If you just want to try it, you can use vite, CRA or even CodeSandbox. The issue looks clearly like a bundler config issue (as the hash package if just a single file exposing a single, default exported function)