Closed dannyrb closed 5 months ago
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
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 usingimport
/export
syntaximport.meta.url
also requires module syntaxjiti
to add buildtime checking, next.config.js does not like module syntax, but client code does not like require / module.exports