Skip to content
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

Add Environment Variables Example #14575

Merged
merged 7 commits into from
Jun 28, 2020

Conversation

lfades
Copy link
Member

@lfades lfades commented Jun 26, 2020

Closes #14570
Closes #14576

  • The example features everything on the page in our docs while still being quite simple
  • Added a link to it in the documentation
  • Deprecated the with-now-env example

@ijjk ijjk added type: documentation examples Issue was opened via the examples template. labels Jun 26, 2020
@ijjk
Copy link
Member

ijjk commented Jun 26, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General
vercel/next.js canary lfades/next.js examples/environment-variables Change
buildDuration 12s 12.1s ⚠️ +145ms
nodeModulesSize 67.1 MB 67.1 MB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary lfades/next.js examples/environment-variables Change
/ failed reqs 0 0
/ total time (seconds) 1.98 2.01 ⚠️ +0.03
/ avg req/sec 1262.62 1243.57 -19.05
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.136 1.223 ⚠️ +0.09
/error-in-render avg req/sec 2201.2 2043.51 -157.69
Client Bundles (main, webpack, commons)
vercel/next.js canary lfades/next.js examples/environment-variables Change
main-HASH.js gzip 6.51 kB 6.51 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..558d.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.1 kB 57.1 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary lfades/next.js examples/environment-variables Change
main-HASH.module.js gzip 5.59 kB 5.59 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.08 kB 7.08 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.6 kB 52.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary lfades/next.js examples/environment-variables Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary lfades/next.js examples/environment-variables Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Rendered Page Sizes
vercel/next.js canary lfades/next.js examples/environment-variables Change
index.html gzip 955 B 955 B
link.html gzip 959 B 959 B
withRouter.html gzip 946 B 946 B
Overall change 2.86 kB 2.86 kB

Serverless Mode
General
vercel/next.js canary lfades/next.js examples/environment-variables Change
buildDuration 13s 12.9s -111ms
nodeModulesSize 67.1 MB 67.1 MB
Client Bundles (main, webpack, commons)
vercel/next.js canary lfades/next.js examples/environment-variables Change
main-HASH.js gzip 6.51 kB 6.51 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..558d.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.1 kB 57.1 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary lfades/next.js examples/environment-variables Change
main-HASH.module.js gzip 5.59 kB 5.59 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.08 kB 7.08 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.6 kB 52.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary lfades/next.js examples/environment-variables Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary lfades/next.js examples/environment-variables Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Serverless bundles
vercel/next.js canary lfades/next.js examples/environment-variables Change
_error.js 875 kB 875 kB
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 876 kB 876 kB
link.js 916 kB 916 kB
routerDirect.js 908 kB 908 kB
withRouter.js 908 kB 908 kB
Overall change 4.49 MB 4.49 MB
Commit: 68becb1

@ijjk
Copy link
Member

ijjk commented Jun 26, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General
vercel/next.js canary lfades/next.js examples/environment-variables Change
buildDuration 11.5s 11.6s ⚠️ +144ms
nodeModulesSize 67.1 MB 67.1 MB
Page Load Tests Overall increase ✓
vercel/next.js canary lfades/next.js examples/environment-variables Change
/ failed reqs 0 0
/ total time (seconds) 1.928 1.903 -0.02
/ avg req/sec 1296.54 1313.47 ⚠️ +16.93
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.165 1.119 -0.05
/error-in-render avg req/sec 2145.61 2233.75 ⚠️ +88.14
Client Bundles (main, webpack, commons)
vercel/next.js canary lfades/next.js examples/environment-variables Change
main-HASH.js gzip 6.51 kB 6.51 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..558d.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.1 kB 57.1 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary lfades/next.js examples/environment-variables Change
main-HASH.module.js gzip 5.59 kB 5.59 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.08 kB 7.08 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.6 kB 52.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary lfades/next.js examples/environment-variables Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary lfades/next.js examples/environment-variables Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Rendered Page Sizes
vercel/next.js canary lfades/next.js examples/environment-variables Change
index.html gzip 955 B 955 B
link.html gzip 959 B 959 B
withRouter.html gzip 946 B 946 B
Overall change 2.86 kB 2.86 kB

Serverless Mode
General
vercel/next.js canary lfades/next.js examples/environment-variables Change
buildDuration 12.2s 12.7s ⚠️ +512ms
nodeModulesSize 67.1 MB 67.1 MB
Client Bundles (main, webpack, commons)
vercel/next.js canary lfades/next.js examples/environment-variables Change
main-HASH.js gzip 6.51 kB 6.51 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..558d.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.1 kB 57.1 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary lfades/next.js examples/environment-variables Change
main-HASH.module.js gzip 5.59 kB 5.59 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.08 kB 7.08 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.6 kB 52.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary lfades/next.js examples/environment-variables Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary lfades/next.js examples/environment-variables Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Serverless bundles
vercel/next.js canary lfades/next.js examples/environment-variables Change
_error.js 875 kB 875 kB
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 876 kB 876 kB
link.js 916 kB 916 kB
routerDirect.js 908 kB 908 kB
withRouter.js 908 kB 908 kB
Overall change 4.49 MB 4.49 MB
Commit: 731d623


// The value here will be defined in the terminal, because of server side rendering,
// but not in the browser console
console.log('[Server only] ENV_VARIABLE:', process.env.ENV_VARIABLE)
Copy link
Member

@timneutkens timneutkens Jun 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is generally not how we should show this example. Instead it should rely on getStaticProps / getServerSideProps (same for the line below)

@ijjk
Copy link
Member

ijjk commented Jun 28, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General
vercel/next.js canary lfades/next.js examples/environment-variables Change
buildDuration 12.9s 12.9s ⚠️ +64ms
nodeModulesSize 67.1 MB 67.1 MB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary lfades/next.js examples/environment-variables Change
/ failed reqs 0 0
/ total time (seconds) 2.202 2.204 0
/ avg req/sec 1135.31 1134.4 -0.91
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.46 1.533 ⚠️ +0.07
/error-in-render avg req/sec 1712.47 1630.28 -82.19
Client Bundles (main, webpack, commons)
vercel/next.js canary lfades/next.js examples/environment-variables Change
main-HASH.js gzip 6.51 kB 6.51 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..558d.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.1 kB 57.1 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary lfades/next.js examples/environment-variables Change
main-HASH.module.js gzip 5.59 kB 5.59 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.08 kB 7.08 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.6 kB 52.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary lfades/next.js examples/environment-variables Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary lfades/next.js examples/environment-variables Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Rendered Page Sizes
vercel/next.js canary lfades/next.js examples/environment-variables Change
index.html gzip 954 B 954 B
link.html gzip 959 B 959 B
withRouter.html gzip 947 B 947 B
Overall change 2.86 kB 2.86 kB

Serverless Mode
General
vercel/next.js canary lfades/next.js examples/environment-variables Change
buildDuration 13.6s 13.9s ⚠️ +291ms
nodeModulesSize 67.1 MB 67.1 MB
Client Bundles (main, webpack, commons)
vercel/next.js canary lfades/next.js examples/environment-variables Change
main-HASH.js gzip 6.51 kB 6.51 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..558d.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.1 kB 57.1 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary lfades/next.js examples/environment-variables Change
main-HASH.module.js gzip 5.59 kB 5.59 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.08 kB 7.08 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.6 kB 52.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary lfades/next.js examples/environment-variables Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary lfades/next.js examples/environment-variables Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Serverless bundles
vercel/next.js canary lfades/next.js examples/environment-variables Change
_error.js 875 kB 875 kB
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 876 kB 876 kB
link.js 916 kB 916 kB
routerDirect.js 908 kB 908 kB
withRouter.js 908 kB 908 kB
Overall change 4.49 MB 4.49 MB
Commit: 9d3332d

@ijjk
Copy link
Member

ijjk commented Jun 28, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General
vercel/next.js canary lfades/next.js examples/environment-variables Change
buildDuration 11.4s 11.4s ⚠️ +61ms
nodeModulesSize 67.1 MB 67.1 MB
Page Load Tests Overall increase ✓
vercel/next.js canary lfades/next.js examples/environment-variables Change
/ failed reqs 0 0
/ total time (seconds) 1.948 1.909 -0.04
/ avg req/sec 1283.45 1309.67 ⚠️ +26.22
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.35 1.357 ⚠️ +0.01
/error-in-render avg req/sec 1851.7 1841.98 -9.72
Client Bundles (main, webpack, commons)
vercel/next.js canary lfades/next.js examples/environment-variables Change
main-HASH.js gzip 6.51 kB 6.51 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..558d.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.1 kB 57.1 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary lfades/next.js examples/environment-variables Change
main-HASH.module.js gzip 5.59 kB 5.59 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.08 kB 7.08 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.6 kB 52.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary lfades/next.js examples/environment-variables Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary lfades/next.js examples/environment-variables Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Rendered Page Sizes
vercel/next.js canary lfades/next.js examples/environment-variables Change
index.html gzip 954 B 954 B
link.html gzip 959 B 959 B
withRouter.html gzip 947 B 947 B
Overall change 2.86 kB 2.86 kB

Serverless Mode
General
vercel/next.js canary lfades/next.js examples/environment-variables Change
buildDuration 12.2s 12.3s ⚠️ +163ms
nodeModulesSize 67.1 MB 67.1 MB
Client Bundles (main, webpack, commons)
vercel/next.js canary lfades/next.js examples/environment-variables Change
main-HASH.js gzip 6.51 kB 6.51 kB
webpack-HASH.js gzip 751 B 751 B
19b7e98f51cc..558d.js gzip 10.7 kB 10.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.1 kB 57.1 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary lfades/next.js examples/environment-variables Change
main-HASH.module.js gzip 5.59 kB 5.59 kB
webpack-HASH..dule.js gzip 751 B 751 B
19b7e98f51cc..dule.js gzip 7.08 kB 7.08 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.6 kB 52.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary lfades/next.js examples/environment-variables Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary lfades/next.js examples/environment-variables Change
_buildManifest.js gzip 268 B 268 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 540 B 540 B
Serverless bundles
vercel/next.js canary lfades/next.js examples/environment-variables Change
_error.js 875 kB 875 kB
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 876 kB 876 kB
link.js 916 kB 916 kB
routerDirect.js 908 kB 908 kB
withRouter.js 908 kB 908 kB
Overall change 4.49 MB 4.49 MB
Commit: b647cf1

@kodiakhq kodiakhq bot merged commit a04fdc8 into vercel:canary Jun 28, 2020
rokinsky pushed a commit to rokinsky/next.js that referenced this pull request Jul 11, 2020
Closes vercel#14570
Closes vercel#14576

- The example features everything on the page in our docs while still being quite simple
- Added a link to it in the documentation
- Deprecated the with-now-env example
@vercel vercel locked as resolved and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue was opened via the examples template.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove the with-now-env example Add environment variables example
3 participants