You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reduce unnecessary warnings when using strict mode in turbo projects that have many internal packages
Allow strict mode users to make it clearer in turbo.json whether internal packages use environment variables
(indirectly) encourage more people to use strict mode
Non-goals
No response
Background
Strict mode's warnings about environment variables are aggressive for turbo monorepos that have many internal packages that don't use environment variables. Imagine I have a next.js app, "web", which imports a package "foo". web uses some environment variables, so I put them in the web#build turbo task. The problem is, turbo (or vercel?) produce a warning like the following:
Warning - the following environment variables are set on your Vercel project, but missing from "turbo.json". These variables WILL NOT be available to your application and may cause your build to fail. Learn more at https://turbo.build/repo/docs/platform-environment-variables
[warn] @my-repo/foo#build
[warn] - ENV_VAR_1
[warn] - ENV_VAR_2
foo doesn't use any environment variables, but there is currently nothing I can add to the foo#build task to tell turbo (or vercel?) "I promise, it doesn't use any environment variables. Please don't warn me if you find some present". My options today are to:
put ENV_VAR_1 and ENV_VAR_2 in foo#build.env. This isn't great because it will likely mislead future turbo.json readers and make them think that foo uses environment variables.
run in loose mode, and risk the dangers of unexpected behavior due to loose mode
ignore the warning, and risk that other warnings are drowned out by this one.
I'm doing 3 right now. It's not a blocker, but IMO this rough edge could be softened 🙂
Proposal
I don't fully know the implications of doing this, but I'd suggest that if a task has "env": ["!*"], then turbo's strict mode should know not to warn. Or maybe, it should be "env": []? Or another property. Just some way to indicate that this package does not intend to use any environment variables.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Goals
Non-goals
No response
Background
Strict mode's warnings about environment variables are aggressive for turbo monorepos that have many internal packages that don't use environment variables. Imagine I have a next.js app, "web", which imports a package "foo". web uses some environment variables, so I put them in the web#build turbo task. The problem is, turbo (or vercel?) produce a warning like the following:
Warning - the following environment variables are set on your Vercel project, but missing from "turbo.json". These variables WILL NOT be available to your application and may cause your build to fail. Learn more at https://turbo.build/repo/docs/platform-environment-variables
[warn] @my-repo/foo#build
[warn] - ENV_VAR_1
[warn] - ENV_VAR_2
foo doesn't use any environment variables, but there is currently nothing I can add to the foo#build task to tell turbo (or vercel?) "I promise, it doesn't use any environment variables. Please don't warn me if you find some present". My options today are to:
I'm doing 3 right now. It's not a blocker, but IMO this rough edge could be softened 🙂
Proposal
I don't fully know the implications of doing this, but I'd suggest that if a task has
"env": ["!*"]
, then turbo's strict mode should know not to warn. Or maybe, it should be"env": []
? Or another property. Just some way to indicate that this package does not intend to use any environment variables.Beta Was this translation helpful? Give feedback.
All reactions