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

Q. How to use it (page router next@14) #156

Open
sacru2red opened this issue Oct 23, 2024 · 2 comments
Open

Q. How to use it (page router next@14) #156

sacru2red opened this issue Oct 23, 2024 · 2 comments

Comments

@sacru2red
Copy link

"next": "^14.2.12",
"node": "20.17.0",

I am using page router
so editr _document.tsx

<Html>
...
<PublicEnvScript />
...
</Html>

and build project and deploy

local (build files) .env : NEXT_PUBLIC_FOO=foo
server machine (build files) .env : NEXT_PUBLIC_FOO=bar

browser console (window['__ENV']) result is NEXT_PUBLIC_FOO=foo

I want NEXT_PUBLIC_FOO=bar (using runtime's env file)

@sacru2red
Copy link
Author

sacru2red commented Oct 28, 2024

After running npm run build, in the created assets

In 404.html, 500.html, index.html
Contains the contents of .env at the time of build. (Probably an area called SSG)

change .env and
If you start again
Changed env values ​​are not reflected.
Isn't this kind of use the purpose of this library?

https://github.com/sacru2red/next-runtime-env-page-router

@sacru2red
Copy link
Author

ref #132

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant