next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Update with-universal-configuration example

Open johntran opened this issue 8 years ago • 6 comments

Feature request

Is your feature request related to a problem? Please describe.

It is confusing for new users to get environment variables set up because there are examples that do not work, and there is an officially supported way of doing environment variables now

https://github.com/zeit/next.js#exposing-configuration-to-the-server--client-side

Describe the solution you'd like

Remove with-universal-configuration from the repo

Describe alternatives you've considered

Open to keeping them if someone shows a unique use case.

johntran avatar May 29 '18 18:05 johntran

It actually serves 2 use cases:

with-universal-configuration - shows build time transpilation of environment variables. Should probably be renamed to with-universal-configuration-build-time

with-universal-configuration-runtime - should show the publicRuntimeConfig implementation. This means that environment variables can be set at runtime, but also means they have to be sent in the pre-rendered document so they have a very small cost

timneutkens avatar May 29 '18 20:05 timneutkens

Hi @timneutkens,

I could take this one.

kvarc7 avatar May 31 '18 14:05 kvarc7

@davcro cool 👍 thanks!

timneutkens avatar May 31 '18 14:05 timneutkens

@davscro ideally we also mention both use cases in the readme so that users can choose what fits them 👍

timneutkens avatar May 31 '18 14:05 timneutkens

I made a change which explains best how to set up a universal application in PR #5948. I believe that changes are enough to close this issue.

toruticas avatar Dec 27 '18 21:12 toruticas

Yep perfect 🙌

timneutkens avatar Dec 27 '18 21:12 timneutkens