@@ -8,7 +8,7 @@ Populate your environment at **runtime** rather than **build time**.
8
8
- Static site generation support.
9
9
- ` .env ` support during development, just like [ Next.js] [ nextjs-env-vars-order ] .
10
10
11
- ### The problem 🤔
11
+ ### Why we created this package 🤔
12
12
13
13
[ Build once, deploy many] [ build-once-deploy-many-link ] is an essential principle
14
14
of software development. The main idea is to use the same bundle for all
@@ -19,21 +19,24 @@ is also part of the [twelve-factor methodology][twelve-factor-link]. As crucial
19
19
as it is, it has yet to receive significant support in the world of front-end
20
20
development, and Next.js is no exception.
21
21
22
- Next.js supports [ environment variables] [ nextjs-env-vars ] , but only at
22
+ Next.js does support [ environment variables] [ nextjs-env-vars ] , but only at
23
23
build time. This means you must rebuild your app for each target environment,
24
24
which violates the principle. But what if you want, or need, to follow the build
25
25
once, deploy many principle?
26
26
27
- ### The solution 🤓
27
+ ### This package 🤓
28
28
29
- ` next-runtime-env ` solves this problem by generating a JavaScript file that is
30
- loaded by the browser and contains the environment variables. We generate this
31
- file at runtime, so you don't have to declare your environment variables at
32
- build time.
29
+ ` next-runtime-env ` solves this problem by generating a JavaScript file that
30
+ contains the environment variables at runtime, so you no longer have to declare
31
+ your environment variables at build time. This file is loaded in the client,
32
+ safely exposing those variables to the browser. This allows you to follow the
33
+ build once, deploy many principle by providing differed runtime variables to the
34
+ same build.
35
+
36
+ ### Compatibility 🤝
33
37
34
38
Our approach is compatible with
35
- [ static site generation] [ static-generation-link ] , and it also supports
36
- middleware.
39
+ [ static site generation] [ static-generation-link ] and supports middleware.
37
40
38
41
### Getting started 🚀
39
42
0 commit comments