Open wintercounter opened 8 months ago
i go through this issue i checked that when i am running this global.ts
without use client
it means on server side its running fine but we run this issue on client side
it's not working. after that i used on client side
a module and export this and use on layout.tsx
. console.log
is working fine on client side
. How it possible if this should not worked on client side also should not work on server side without any module.
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/white-sky-synrgh?file=%2Fapp%2Flayout.tsx%3A1%2C19
To Reproduce
layout.tsx
loadingglobal.ts
without any modules imported.global.ts
does not log anything.Current vs. Expected behavior
console.log
should be executed on server side. It is only executed if I actually define a module, load it, and use it in my layout.For example, add the following to
global.ts
:Use the module in
layout.tsx
:The above will make it work.
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response