tauri is powered by vite.
docs and web are nextjs.
in packages/utils I am talking with external services like Supabase.
The web and docs sites demand i use process.env.ENV_VAR to access variables
and tauri ( vite ) require i use import.meta.env.ENV_VAR.
Basically my packages/utils package can only build for either nextjs or vite and not both because consuming applications are dictating env variable access schemes.
Expected Behavior
I expect external packages can use the env system expected of the package and it doesnt matter who is consuming them.
What version of Turborepo are you using?
latest
What package manager are you using / does the bug impact?
pnpm
What operating system are you using?
Mac
Describe the Bug
I have a repo based on the tailwind starter.
packages/ui packages/typescript packages/tailwind packages/utils etc
I also have
apps/web apps/docs apps/tauri
tauri is powered by vite. docs and web are nextjs.
in packages/utils I am talking with external services like Supabase.
The web and docs sites demand i use process.env.ENV_VAR to access variables and tauri ( vite ) require i use import.meta.env.ENV_VAR.
Basically my packages/utils package can only build for either nextjs or vite and not both because consuming applications are dictating env variable access schemes.
Expected Behavior
I expect external packages can use the env system expected of the package and it doesnt matter who is consuming them.
To Reproduce
pnpm build.
check my ugly hack for dev mode here where i switch between impor.meta.env and process.env depending on whats up https://github.com/tryanything-ai/anything/commit/0d177ef5639532809bf11c59d06d6d7ffc421ed9#diff-1a60c5a3d399e5126728747c92f439796071799d9676ac38cf929e44f31d64e4
Reproduction Repo
https://github.com/tryanything-ai/anything/commit/0d177ef5639532809bf11c59d06d6d7ffc421ed9
TURBO-1551