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
Смотрите видео Next.js Tutorial - Part 10 | Environment Variables and Runtime Configuration онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Bruno Antunes 24 Апрель 2020, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 24,925 раз и оно понравилось 480 людям.