Client side.
See original GitHub issueI don’t sure if this has been asked before, but can this package access environment variables on the client side? I tried to print the env variable to the console, but it said it was undefined
, even though I could see what it printed in the terminal. I know I’m terrible at explaining, but maybe the image i’ve included may help.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Client-side - Wikipedia
Client -side refers to operations that are performed by the client in a client–server relationship in a computer network.
Read more >What Is the Client Side? | Definition by Elementor
The Client-side is everything in a web application displayed or occurring on a client's (end user's) device, including what they see – images,...
Read more >Client-side web APIs - Learn web development | MDN
When writing client-side JavaScript for web sites or applications, you will quickly encounter Application Programming Interfaces (APIs).
Read more >Client-side vs. Server-side - Educative.io
Client -side means that the processing takes place on the user's computer. It requires browsers to run the scripts on the client machine...
Read more >What is Client-side? - Definition from Techopedia
Client -side refers to a specific part of client/server architecture, which is a network structure distinguishing clients or computers ordering information ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This seems to be related with how Next.js handles
process.env
. It says here in the docs that they inline the value to the browser. They also explicitly state that “dynamic lookups will not be inlined”.Based on my understanding, this means that if your code is:
Next.js compiles it to:
You need to explicitly make a call to
process.env.NEXT_PUBLIC_BASE_URL
someplace for it to be replaced by their compilation steps.Using this knowledge I found the following example works when using env-var:
This is a little convoluted, but it’s a quick workaround I’ve found works with the basic
npx create-next-app@latest
template.That’s great! I referenced this issue for the next release. Will add a doc section for this issue.