Skip to content

Commit

Permalink
chore: bump devDependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
tianyingchun committed Sep 2, 2024
1 parent 9ae0d20 commit a29826e
Show file tree
Hide file tree
Showing 3 changed files with 366 additions and 348 deletions.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,51 @@ next.js Bundling Environment Variables for the Browser at build time
- https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables
- hyper-env only attach Environment Variables on `processs.env`
- we need to expose runtime env variables via `next-runtime-env`, otherwise we can not correct use these env variables in browser
- If you use `_pages router` you must be use SSR mode.

```tsx
import { GetServerSideProps } from 'next';
import { HealthClient } from './client';

// Must be declared as SSR for 'next-runtime-env';
export const getServerSideProps: GetServerSideProps = async () => {
return {
props: {},
};
};

export default function EnvPage() {
return (
<div>
<HealthClient />
</div>
);
}
```

```tsx
// client.tsx
'use client';

import { env } from 'next-runtime-env';

export default () => {
return (
<div>
<p>Client env:</p>
<div>
<p>NEXT_PUBLIC_ENV(env): {env('NEXT_PUBLIC_ENV')}</p>
<p>NEXT_PUBLIC_TEXT(process): {process.env.NEXT_PUBLIC_TEXT}</p>
</div>
</div>
);
};
```

```tsx
// _app.tsx

import { PublicEnvScript } from 'next-runtime-env';

<PublicEnvScript />;
```
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,24 @@
"devDependencies": {
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.7",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@hyperse/eslint-config-hyperse": "^1.0.12",
"@commitlint/cli": "19.4.1",
"@commitlint/config-conventional": "19.4.1",
"@hyperse/eslint-config-hyperse": "^1.1.3",
"@hyperse/exec-program": "^1.0.10",
"@types/minimist": "^1.2.5",
"@types/node": "^22.0.2",
"@types/react": "^18.3.3",
"@types/node": "^22.5.2",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"commitizen": "4.3.0",
"cz-conventional-changelog": "3.3.0",
"eslint": "^9.8.0",
"husky": "9.1.4",
"lint-staged": "15.2.7",
"next": "14.2.5",
"eslint": "^9.9.1",
"husky": "9.1.5",
"lint-staged": "15.2.10",
"next": "14.2.7",
"npm-run-all": "^4.1.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tsup": "^8.2.3",
"tsup": "^8.2.4",
"typescript": "^5.5.4",
"vitest": "^2.0.5"
},
Expand Down
Loading

0 comments on commit a29826e

Please sign in to comment.