Next.js Discord

Discord Forum

Unable to build production app in next 13

Unanswered
akki1234 posted this in #help-forum
Open in Discord
I am building an app in next 13. When building the app locally it is working fine yarn dev but as soon as I trigger a production build, pre-rendering starts failing.
I have a global function __ that we use in our application. I have in my code added a code like below
global.__ = a => a;

But while next JS picks this up in the dev build, in the production build it is telling __ is not defined. Can someone please help me resolving this issue.

2 Replies

I was able to debug that fact that the global function that I am trying to define is somehow not getting defined in production build with global.__ need to find some way out for it.
Can you explain more what you mean by global function?