timarney / react-app-rewired

Override create-react-app webpack configs without ejecting
MIT License
9.77k stars 425 forks source link

Modify .env path #568

Closed createdbymahmood closed 2 years ago

createdbymahmood commented 2 years ago

I want to change the .env file path in a CRA project and this is how my config-overrides.js looks like:

module.exports = {
    paths: (paths, env) => {
        const p = {
            dotenv: "./config/.env",
        };
        return p;
    },
};

but it still loads the env file in the root of the project.

        "react-app-rewired": "^2.1.8"
        "react-scripts": "4.0.3",
sperezm97 commented 2 years ago

Any solution for this @createdbymahmood ?