The dotenv people suggest using the import 'dotenv/config'; that way it includes and initiates the config before anything else. not sure if that is what you are looking for here
import 'dotenv/config';