I'd suggest using the custom path option if you know you're looking for .envrc. It's also harmless to try to attempt to load two or more files yourself.
const dotenv = require('dotenv')
dotenv.config()
dotenv.config({ path: '.envrc' })
Thanks @maxbeatty, I'll try that.
@adjohnson916 This should work for very specific cases where you are absolutely sure that your .envrc file only includes variable assignments; however, it could easily go south if your .envrc file includes other commands which dotenv does not support.
Also, I'm just curious to hear of other people's workflow...if you are already using direnv, why use dotenv locally at all? Shouldn't direnv allow be enough?
@wilmoore I figured. Why? Might not be running the app from the current working directory, or from a different user account e.g. a system account that's not running with a shell and/or doesn't have direnv configured . Might want to use dotenv on a server to provide environment-specific configuration to the deployed application, defaulting to variables specified for local dev in .envrc via direnv.
Thanks @adjohnson916 -- good to know.