Importing modules accordingly on server and client
Unanswered
American Wirehair posted this in #help-forum
American WirehairOP
Remix have this way of importing files that are server/client specific by simply specifying
Tried to dynamically import a server-only code if
Reproduction:
https://codesandbox.io/p/devbox/late-browser-63x7lt
.server.ts or .client.ts. Is there a way to make the same on Next?Tried to dynamically import a server-only code if
typeof window === 'undefined' but since this module is also used inside a useEffect in a client component it throws me an error without even executing the code.Reproduction:
https://codesandbox.io/p/devbox/late-browser-63x7lt