#Cannot get onClick event to fire

1 messages · Page 1 of 1 (latest)

mighty notch
#

<Scripts /> is in my root.tsx file, and I don't see any event if I set an event listener breakpoint in devtools. This is version 1.8.1. Not sure what else I need to do to get this to work

mighty notch
#

I noticed that I can't see entry.client code in devtools source navigator, despite it being called in the script.

#

all of the other files that get referenced appear in the navigation tree on the left. Not sure why entry.client does not.

mighty notch
#

ok, testing another page in incognito works - I see that I am getting an error Uncaught ReferenceError: process is not defined at loadProxy (gaxios.ts:65:9) at node_modules/gaxios/build/src/gaxios.js

#

not sure why it is trying to load that client side

mighty notch
#

Ok, looks like you have to segregate server only code in a mycode.server.ts

#

the build process is not smart enough to know that if you only reference a library in a loader / action, not to put it in the browser bundle

mint zodiac
#

It is smart enough as long as the library doesn't perform any work when it is imported. If it only exports then tree-shaking works. Any calls to functions at the module scope causes it to not be tree-shakeable and need to be imported only from a .server.ts file.

This is similar to how route modules cannot perform any work outside of the loader, action and component definitions otherwise the code will get included in both bundles.