How t3env works in an nx integrated enviroment monorepo? #305
Unanswered
codersaadi
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using nx repo with nextjs integrated enviroment , env variables are the concern ,
as t3env does not support node module resolution, so it is a problem.
nx js provides a base.json at the root level with module resolution node for nextjs integrated enviroment
Cannot find module '@t3-oss/env-core' or its corresponding type declarations.
There are types at '/home/code/Desktop/monorepos/org/node_modules/@t3-oss/env-core/dist/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.ts(2307)
with node 16
The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@t3-oss/env-core")' call instead.
To convert this file to an ECMAScript module, change its file extension to '.mts', or add the field
"type": "module"
to '/home/code/Desktop/monorepos/org/libs/shared/package.json'.ts(1479)module "/home/code/Desktop/monorepos/org/node_modules/.pnpm/@t3-oss+env-core@0.11.1_typescript@5.5.4_zod@3.23.8/node_modules/@t3-oss/env-core/dist/index"
should i use core ?
there could be multiple apps like react etc , so i think core should be appropriate , will it work in nextjs the sameway , t3next works ? i have seen
no example of it so far
i have solved it by coping the code of t3 core internally
and using it as utility from the utils.
otherwise it was resulting in type issues.
import { createEnv } from './lib/internal-env';
but thats not a very friendly solution
Beta Was this translation helpful? Give feedback.
All reactions