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

Installation steps do not work for net new Next.js Apps #213

Closed
dannyrb opened this issue Apr 2, 2024 · 1 comment
Closed

Installation steps do not work for net new Next.js Apps #213

dannyrb opened this issue Apr 2, 2024 · 1 comment

Comments

@dannyrb
Copy link

dannyrb commented Apr 2, 2024

I found the two sets of documentation above, and attempted to follow each of them in a net new next.js project with Typescript. Here are some issues I encountered:

  • next.config.js does not build when using import/export syntax
  • import.meta.url also requires module syntax
  • One set of docs calls out "validating environment variables at runtime and buildtime", but the default setup does not seem to create buildtime checking
  • If using jiti to add buildtime checking, next.config.js does not like module syntax, but client code does not like require / module.exports
@juliusmarminge
Copy link
Member

juliusmarminge commented Apr 8, 2024

Module syntax is based on you having package.json#type set to module. If you don't have that then you need to use the .mjs extension. This is true for any javascript file so I don't see why we should make this clear in our docs.

Validating schema on build is done by importing the env file into your next config as shown here: https://env.t3.gg/docs/nextjs#validate-schema-on-build-(recommended)

Checkout our example if you wanna see more details: https://github.com/t3-oss/t3-env/tree/main/examples/nextjs

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

2 participants