preactjs/prefresh

@prefresh/vite: Suspense / lazy breaks when saving different files

JonasKruckenberg opened this issue · 3 comments

I came across an issue where refreshing from a different file other than the rendering one + using preacts Suspense/lazy would produce the following error

suspense.js:235 Uncaught (in promise) TypeError: t2.__e is not a function
    at U (suspense.js:235)
    at L.__c (suspense.js:124)
    at Object.l.__e (suspense.js:18)
    at j (index.js:255)
    at w (children.js:137)
    at j (index.js:198)
    at w (children.js:137)
    at j (index.js:198)
    at w (children.js:137)
    at j (index.js:198)

the actual cause of this issue is probably in the intro between prefresh and preact, but since it's triggered by refreshing from different files than the entrypoint the logical step would be to start with prefresh.
I'm willing to help in any way I can to debug this.

I wonder if it is because Preact just called oldCatchError without checking if it exists here, _catchError is __e https://github.com/preactjs/preact/blob/master/mangle.json#L71

I don't know to be honest, I looked over my test case and ensured that all function names are capitalized and after that the issue was gone (not sure for how long however, since it appeared without me renaming functions) but I'll reopen this issue when it happens again :)
Anyway thanks for your quick response 👍🏻