Include integration guide for Turborepo?
So I was trying to integrate dotenv-vault with Turborepo, and sometimes we have to define some ENV variable as part of the Turborepo hashing config so that Turborepo will rerun the build if one of the ENV changed.
However, most of the integration guides required us to require('dotenv-vault-core').config() in the build config files like next.config.js, remix.config.js, vite.config.js etc. This might not work with Turborepo, as it might not able to detect any ENV changes.
I was able to figure that out by preloading the .env.vault before the Turborepo CLI command like node -r dotenv-vault-core/config ./node_modules/.bin/turbo build, in fact, it's similar to the Astro integration guide, so I thought it might be a good idea to have a guide/doc to mention about this "Preload dotenv-vault-core" thing, as popular tools like Turborepo might need it.
Great insight @chungweileong94. We will add that. We will also likely update those other tutorials to use preloading instead. Those were written before preloading was added to dotenv-vault-core.
Just notice that this node -r dotenv-vault-core/config ./node_modules/.bin/turbo build doesn't work with pnpm, but works fine with yarn. It seems like something to do with how the package manager handles the bin, sadly I have very little knowledge of that.
For pnpm, one workaround is to set in the .npmrc file the following line :
node-linker=hoisted
In my case it's introducing errors with multiple instances of react that the default pnpm store was solving.