-
Notifications
You must be signed in to change notification settings - Fork 27.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass variable to _document.js from server.js #3367
Comments
@timneutkens thanks for your example. I understand you export env config to
It loads the file and do some validate. however it cannot be executed on client side. The env config should be decided on server side, and I can decided what I should export to client side. So I am curious about if I make this variable from create next.
Is it possible? |
@blackbing |
@timneutkens npm run build
API_URL='https://example.com' npm run start This is needed when building on CI server and running resulting build on many environments with different configuration. |
Can I pass some variable from create
next
? for examplethen I can get this
GA_ID
variable in _document.js and render it.I know universal-config provide another way to handle it, but it will be replaced in the build time. If I have several different environment. I have to build by different config. So I hope I can pass variable to render _document.js
related issue is #159 but as I mentioned above, universal-config will replace variable in the build time instead of run time. so I hope there is a better way to do that.
The text was updated successfully, but these errors were encountered: