In this video, we will set environment variables, serverRuntimeConfig and publicRuntimeConfig.
We also have a look into cross-env and dotenv packages to help us out with environment variables
From Next.js documentation:
Generally, you'll want to use build-time environment variables to provide your configuration. The reason for this is that runtime configuration (serverRuntimeConfig and publicRuntimeConfig) adds rendering/initialization overhead and is incompatible with Automatic Static Optimization.
----
Timeline:
00:00 Presentation Starts
01:33 Open VsCode and env variable setup recommendation using cross-env
03:50 build-time environment variables
05:15 use next.config.js
07:55 create a new component with getServerSideProps to use runtime configuration
13:40 warning for some possible security problems when using serverRuntimeConfig
15:20 simple example using dotenv
18:30 Conclusion
----
Github Repository: https://github.com/bmvantunes/youtube...
----
Follow me on:
Twitter: / bmvantunes
Dev.to: https://dev.to/bmvantunes
Website: https://brunoantunes.net
Github: https://github.com/bmvantunes
LinkedIn: / bmvantunes
Watch video Next.js Tutorial - Part 10 | Environment Variables and Runtime Configuration online without registration, duration hours minute second in high quality. This video was added by user Bruno Antunes 24 April 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 24,925 once and liked it 480 people.